I tried run my code in the Lab: Build a Lunch Picker Program in the JavaScript certification but in a moment to other, now my all code is wrong. I don´t know what´s happend
Welcome to the forum @CristianGab16,
We cannot test from screenshots. Please post your code, formatted as follows:
There are two ways you can format your code to make it easier to read and test:
- After you copy/paste your code into the editor, select it by dragging your cursor over it then click the (
</>) button in the toolbar to automatically wrap your code in backticks. (You can click on the animated demo image below to enlarge it.)
- Manually add three backticks on a new line above your code and on a new line after your code. Note that a backtick is NOT the same as a single quote('). To find the backtick key on your keyboard, see this post.
To see changes to your post as you make them, you can click the (M+) button on the toolbar to bring up the rich text editor:
My code has 2 errors that I was debuging but for a instant, the test mark all my code was wrong. That´s my problem, I don´t know if it is a problem whit plataform.
For anything, here´s my code:
const lunches = \[\];
function addLunchToEnd(array, string){
array.push(string);
console.log(\`${string} added to the end of the lunch menu.\`);
return array;
}
function addLunchToStart(array, string){
array.unshift(string);
console.log(\`${string} added to the start of the lunch menu.\`);
return array;
}
function removeLastLunch(array) {
if (array.length === 0) {
console.log("No lunches to remove.");
}
console.log(\`${array\[array.length - 1\]} removed from the end of the lunch menu.\`);
array.pop();
return array;
}
function removeFirstLunch(array){
if(array.length === 0){
console.log("No lunches to remove.");
}
console.log(\`${array\[0\]} removed from the start of the lunch menu.\`)
array.shift();
return array;
}
function getRandomLunch(array){
if(array.length ===0 ){
console.log("No lunches available.");
}
const randomNum = Math.floor(Math.random() \* ((array.length - 1) - 0 + 1)) + 0;
console.log(\`Randomly selected lunch: ${array\[randomNum\]}\`)
}
function showLunchMenu(array){
if(array.length === 0){
console.log("The menu is empty.")
}
console.log(\`Menu items: ${array}\`)
}
const array = \["Stew", "Soup", "Toast"\];
removeLastLunch(array)
showLunchMenu();
console.log()
Already watch the error.
There is a problem when I invocate the function showLunchMenu().
And for this problem, all my code mark it bad.
Sorry… I thought it was a problem with the platform
No worries.
Shouldn’t this function call include an argument? Check the function definition, please.
Happy coding


