Build a Shopping List - Step 5

Tell us what’s happening:

let getShoppingListMsg = function(arraY = ) { let arrayContent = arraY.join(", "); return "Current Shopping List: " + arrayContent; }only error left = Your getShoppingListMsg function should accept an array as an argument.

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

console.log(shoppingList);
let getShoppingListMsg = function(arr) {
  let arrayContent = arr.join(", ");
  return "Current Shopping List: " + arrayContent;
}
console.log(getShoppingListMsg(shoppingList));


// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36

Challenge Information:

Build a Shopping List - Step 5

You can use template literals or string concatenation with the + operator to combine the string with the array passed to the function.

You don’t need to join the array. Just concatenate it as it is.

Ok Sir, Thanks. :blush::blush: :blush:

1 Like