Build a Lunch Picker Program - Build a Lunch Picker Program

Tell us what’s happening:

I cant solve 29 AND 30. I would appreciate if you can help me

Your code so far

let lunches = [];

function addLunchToEnd(arr, str){
    arr.push(str);
    console.log(`${str} added to the end of the lunch menu.`);
    return arr;
}

console.log(addLunchToEnd(lunches, "Tacos"));
console.log(addLunchToEnd(["Pizza", "Tacos"], "Burger"));

function addLunchToStart(arr, str){
    arr.unshift(str);
    console.log(`${str} added to the start of the lunch menu.`);
    return arr;
}

console.log(addLunchToStart(lunches, "Sushi"));
console.log(addLunchToStart(["Burger", "Sushi"], "Pizza"));

function removeLastLunch(arr) {
  let removed = arr.pop();
  if (arr.length === 0) {
    console.log("No lunches to remove.");
  }
  else {
    console.log(`${removed} removed from the end of the lunch menu.`);
  }
  return arr;
}

function removeFirstLunch(arr){
  let removed = arr.shift();
  if (arr.length === 0) {
    console.log("No lunches to remove.")
  }
  else {
    console.log(`${removed} removed from the start of the lunch menu.`);
  }
  return arr;
}

console.log(removeFirstLunch(["Salad", "Eggs", "Cheese"]));
console.log(removeFirstLunch(["Sushi", "Pizza", "Burger"]));

function getRandomLunch(arr){
  let random = arr[Math.floor(Math.random() * arr.length)]
  if(arr.length === 0){
    console.log("No lunches available.");
  }
  else {
    console.log(`Randomly selected lunch: ${random}`);
  }
  return arr;
}

console.log(getRandomLunch(lunches));

function showLunchMenu(arr){
  if(arr.length === 0){
    console.log("The menu is empty.")
  }
  else {
    console.log(`Menu Items: ${arr}`);
  }
}

console.log(showLunchMenu(["Greens", "Corns", "Beans"]));
console.log(showLunchMenu(["Pizza", "Burger", "Fries", "Salad"]));




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

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

Your return value should match the spacing that is shown in the test’s “should log” info.