Build a Lunch Picker Program - Build a Lunch Picker Program

Tell us what’s happening:

Steps 29 and 30 don’t pass even though my code produces the expected output. I have tried every solution I can find. I will appreciate any guidance on this problem.

Your code so far

let lunches = [];
let lunchitems=[...lunches]

function addLunchToEnd(lunches, string) {
  lunches.push(string);
  console.log(`${string} added to the end of the lunch menu.`)
  return lunches;
}
function addLunchToStart(lunches, string) {
  lunches.unshift(string);
  console.log(`${string} added to the start of the lunch menu.`)
  return lunches;
}
function removeLastLunch(lunches) {
  if (lunches.length > 0) {
    let removedItemLast = lunches.pop();
    console.log(`${removedItemLast} removed from the end of the lunch menu.`);
  } else {
    console.log("No lunches to remove.");
  }
  return lunches;
}
function removeFirstLunch(lunches) {
  if (lunches.length > 0) {
  let firstItem = lunches.shift();
  console.log(`${firstItem} removed from the start of the lunch menu.`);
  return lunches;  
} else {
  console.log("No lunches to remove.");
}
return lunches;
}
function getRandomLunch(lunches) {
  if (lunches.length > 0) {
  lunches = lunches[Math.floor(Math.random() * lunches.length)];
   console.log(`Randomly selected lunch: ${lunches}`);
  }
 else {
  console.log("No lunches available.");
}
return lunches;
}

const showLunchMenu = (lunches) => {
  if (lunches.length > 0) {
    console.log(`"Menu items: ${lunches}"`);
} 
  else {
  console.log("The menu is empty.");
  }
}
showLunchMenu(`${["Greens"," Corns", " Beans"]}`);
showLunchMenu(`${["Pizza", "Burger", "Fries", "Salad"]}`);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36

Challenge Information:

Build a Lunch Picker Program - Build a Lunch Picker Program
https://www.freecodecamp.org/learn/full-stack-developer/lab-lunch-picker-program/build-a-lunch-picker-program

Start by calling the function correctly, as indicated in the tests:
showLunchMenu(["Greens", "Corns", "Beans"])

You’re using syntax for a template literal string and forcing the spacing.

Then think about what do you need to do to make sure the lunches are comma-space separated.

Thanks for the quick response to my questions. I’ve changed the function calls to what the tests require . And I’ve used the . join method to create the comma-space delimiter. The output to the console looks just like what is being asked for, but I am still getting the same errors for steps 28 and 29.

`const showLunchMenu = (lunches) => {

if (lunches.length > 0) {

lunches = lunches.join(", ")       

console.log('"Menu items: '+lunches+'"');

}

else {

console.log(“The menu is empty.”);

}

}

showLunchMenu([“Greens”, “Corns”, “Beans”])

showLunchMenu([“Pizza”, “Burger”, “Fries”, “Salad”]) `

Your issue is now here. You just need to log the string shown, not the quotes around the string.

Thank you, thank you! That did it!