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