It says i have a syntax error on line 48? Im stumped.
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) {
console.log("No lunches to remove.");
} else {
let lunchItem = lunches.pop();
console.log(`${lunchItem} removed from the end of the lunch menu.`);
}
return lunches;
};
function removeFirstLunch(lunches) {
if (lunches.length === 0) {
console.log("No lunches to remove.");
} else {
let lunchItem = lunches.shift();
console.log(`${lunchItem} removed from the start of the lunch menu.`);
}
return lunches;
}
function getRandomLunch(lunches) {
const arrLength = lunches.length;
const random = Math.floor(Math.random() * lunches.length);
const randomLunch = lunches[random];
if (lunches.length === 0) {
console.log("No lunches available.");
} else {
return console.log(`Randomly selected lunch: ${randomLunch}`);
}
}
function showLunchMenu(lunches) {
if (lunches.length > 0) {
console.log(`Menu items: ${lunches}`);
return lunches;
} else {
console.log("The menu is empty.");
return "The menu is empty.";
}
}
showLunchMenu([" Greens ", " Corn ", " Beans "]);
showLunchMenu(["Pizza", "Burger", "Fries", "Salad"]);