Build a Shopping List - Step 5

Tell us what’s happening:

cant pass the test :

console.log(“Grocery shopping list”);

const shoppingList = ;

console.log(“It will be nice to have some fruit to eat.”);

shoppingList.push(“Apples”);

function getShoppingListMsg (shoppingList){
return "Current Shopping List: "+shoppingList;

}
console.log(getShoppingListMsg(shoppingList))

Your code so far

console.log("Grocery shopping list");

const shoppingList = [];

console.log("It will be nice to have some fruit to eat.");

shoppingList.push("Apples");


// User Editable Region

function getShoppingListMsg (shoppingList){
   return "Current Shopping List: "+shoppingList;
   
}
console.log(getShoppingListMsg(shoppingList))

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36

Challenge Information:

Build a Shopping List - Step 5

I understand why you did that, and I think I will open an issue about it, but your function should not have a parameter, you should reference the global array

1 Like

It is working. Thank you, sir.
However, the output is still the same, I have no idea why I did not pass the test.

Because the function in the tests is called getShoppingListMsg(), no argument
Your function would always return Current Shopping List: undefined

1 Like