Tell us what’s happening:
Can anyone tell me why it doesn’t pass any of the tests?
Your code so far
let lunches = [];
function addLunchToEnd(lunches, lunchItem){
lunches.push(lunchItem);
console.log(`${lunchItem} added to the end of the lunch menu.`);
return lunches;
}
function addLunchToStart (lunches , lunchItem){
lunches.unshift(lunchItem);{
console.log(`${lunchItem} added to the start of the lunch menu.`)
return lunches;
}
function removeLastLunch (lunches) {
if(lunches.length == 0){
return console.log("No lunches to remove.");
}
else {lunches.pop();
console.log(`${lunchItem} removed from the end of the lunch menu.`)
return lunches;
}
function removeFirstLunch (lunches) {
if(lunches.length == 0){
return console.log("No lunches to remove.")
} else{
lunches.shift();
console.log(`${lunchItem} removed from the start of the lunch menu.`)
return lunches;
}
function getRandomLunch (lunches){
const randomLunch = Math.floor(Math.random() * lunches.length);
if(lunches.length == 0){
console.log(`No lunches available.`);
}else{
return `Randomly selected lunch: ${randomLunch}`;}
}
function showLunchMenu (lunches){
if (lunches.length == 0){
return "The menu is empty.";
} else{
return console.log(`Menu items: ${lunches}`);
}
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Challenge Information:
Build a Lunch Picker Program - Build a Lunch Picker Program

