Tell us what’s happening:
Tests 29 and 30 won’t complete and I need assistance on the right solution. Any help is much appreciated.
Your code so far
const lunches = [];
const addLunchToEnd = (arr, str) => {
arr.push(str);
console.log(`${str} added to the end of the lunch menu.`);
return arr;
};
const addLunchToStart = (arr, str) => {
arr.unshift(str);
console.log(`${str} added to the start of the lunch menu.`);
return arr;
};
const removeLastLunch = arr => {
if (arr.length !== 0) {
let removedLunch = arr.pop();
console.log(`${removedLunch} removed from the end of the lunch menu.`);
} else {
console.log("No lunches to remove.");
}
return arr;
};
const removeFirstLunch = arr => {
if (arr.length !== 0) {
let removedLunch2 = arr.shift();
console.log(`${removedLunch2} removed from the start of the lunch menu.`);
} else {
console.log("No lunches to remove.");
}
return arr;
};
const getRandomLunch = arr => {
if (arr.length == 0) {
console.log('No lunches available.');
} else {
let ranLunchNum = Math.floor(Math.random() * 3);
let ranLunch = arr[ranLunchNum];
console.log(`Randomly selected lunch: ${ranLunch}`);
}
}
const showLunchMenu = arr => {
if (lunches.length != 0) {
console.log(`Menu items:${arr}`)
} else {
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/140.0.0.0 Safari/537.36 Edg/140.0.0.0
Challenge Information:
Build a Lunch Picker Program - Build a Lunch Picker Program
https://www.freecodecamp.org/learn/full-stack-developer/lab-lunch-picker-program/build-a-lunch-picker-program
