Build a Lunch Picker Program - Build a Lunch Picker Program

Tell us what’s happening:

It logs exactly what the exercise s asking for, still doesn’t pass.

const showLunchMenu = arr => {
if (arr.length === 0) {
console.log(“The menu is empty.”)
}
else {
let arrstr = arr.join(", ")
console.log(Menu items: ${arrstr} )
}
}

showLunchMenu([“Pizza”, “Burger”, “Fries”, “Salad”]);

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) {
    console.log("No lunches to remove.")
    return arr
  } 
  else { let lunch = arr.pop()
  console.log(`${lunch} removed from the end of the lunch menu.`)
  return arr}
}

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

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



const showLunchMenu = arr => {
  if (arr.length === 0) {
    console.log("The menu is empty.")
  } 
  else { 
    let arrstr = arr.join(", ")
    console.log(`Menu items: ${arrstr} `)
  }
}

showLunchMenu(["Pizza", "Burger", "Fries", "Salad"]);



Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:148.0) Gecko/20100101 Firefox/148.0

Challenge Information:

Build a Lunch Picker Program - Build a Lunch Picker Program

This is the difference between your output and the desired string:

"Menu items: Greens, Corns, Beans "
"Menu items: Greens, Corns, Beans"