Tell us what’s happening:
hi am failing tests 24, 25, and 29, 30 the more i try to solve it the more confused i am getting, any pointer greatly appreciated
Your code so far
let lunches = [];
function addLunchToEnd(lunches, str) {
lunches.push(str);
console.log(`${str} added to the end of the lunch menu.`);
return lunches;
}
function addLunchToStart(lunches, str2) {
lunches.unshift(str2);
console.log(`${str2} added to the start of the lunch menu.`);
return lunches;
}
function removeLastLunch(lunches) {
if (lunches.length !== 0) {
let removed = lunches.pop();
console.log(`${removed} 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 removed = lunches.shift();
console.log(`${removed} removed from the start of the lunch menu.`);
} else {
console.log(`No lunches to remove.`);
}
return lunches;
}
function getRandomLunch(lunches) {
if (lunches.length == 0) {
console.log(`No lunches available.`);
} else if (lunches != 0) {
let random = lunches[math.floor(math.random() * (lunches.length))];
console.log("Randomly selected lunch: ${random(random)}");
}
}
function showLunchMenu(lunches) {
if (lunches.length != 0) {
console.log("Menu items: ${lunches}");
} else if (lunches == 0) {
console.log(`The menu is empty.`);
}
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0
Challenge Information:
Build a Lunch Picker Program - Build a Lunch Picker Program