Build a Lunch Picker Program

function removeLastLunch(arr) {

if (arr.length > 0) {

    let result = arr.pop();
    console.log(result + " removed from the end of the lunch menu.");

} else {

    console.log(" No lunches to remove.");

}

return arr;

}

My code is not passing even though it works on my machine. I´m getting the following error that I cannot reproduce:

  1. When the input array is empty, the function removeLastLunch should log the string "No lunches to remove." to the console.

Welcome back, @JC-Coelho !

Please post all of your code and a link to the challenge.


When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like

Please double-check the string you are returning when the array is empty. It should match exactly to the text in the instructions, including spacing.

1 Like

Thank you. Yes I had a space in there. It figures :confused: