Tell us what’s happening:
I have the shoppingList array with what “should now have 5 items in it”. It looks like I did pop to the array.
At the bottom it says “shoppingList” is read-only.
What am I inputting wrong here?
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");
function getShoppingListMsg(arr) {
return `Current Shopping List: ${arr}`;
}
console.log(getShoppingListMsg(shoppingList));
shoppingList.push("Grapes");
console.log(getShoppingListMsg(shoppingList));
console.log("It looks like we need to get some cooking oil.");
shoppingList.unshift("Vegetable Oil");
console.log(getShoppingListMsg(shoppingList));
shoppingList.push("Popcorn", "Beef Jerky", "Potato Chips");
console.log(getShoppingListMsg(shoppingList));
console.log("This looks like too much junk food.");
// User Editable Region
shoppingList = ["Vegetable Oil", "Apples", "Grapes", "Popcorn", "Beef Jerky"];
shoppingList.pop();
console.log(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/136.0.0.0 Safari/537.36
Challenge Information:
Build a Shopping List - Step 14