Build a Lunch Picker Program - Build a Lunch Picker Program

Tell us what’s happening:

why this this code passed the test number 5 which is
log a Tacos added to the end of the menu.
let lunches = ;
function addLunchToEnd(arr, str) {
arr.push(str)
console.log(${str} added to the end of the lunch menu.);
return arr;
}
addLunchToEnd(lunches,[“Pizza”, “Tacos”, “Burger”]);

Your code so far

let lunches = [];
function addLunchToEnd(arr, str) {
  // let newArr = arr.push(str);
  // const lastItem = arr.slice(-1)
  // const lastItem = arr.pop();
arr.push(str)
  console.log(`${str} added to the end of the lunch menu.`);
  return arr;
}
addLunchToEnd(lunches,["Pizza", "Tacos", "Burger"]);
// console.log(lunches)

//
//

// function addLunchToStart(arr, str) {
//   str = " added to the start of the lunch menu.";

//   const lastItem = arr.shift();

//   console.log(`${lastItem}${str} `);
//   return lastItem;
// }
// addLunchToStart(lunches, "Sushi");


Your browser information:

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

Challenge Information:

Build a Lunch Picker Program - Build a Lunch Picker Program

what issue are you having with this code?

I dont understand why the code passed even though the input are totally different

what input are you talking about?

output: Pizza,Tacos,Burger added to the end of the lunch menu.
but the test expected to have output of : Tacos added to the end of the lunch menu.
Even though the output are wrong the test still accept it.

you are confusing what you are seeing in the console, and your function being tested

this function is not part of the tests

the tests are testing with addLunchToEnd(lunches, "Tacos") and addLunchToEnd(["Pizza", "Tacos"], "Burger")