var shoppingList = ["milk", "eggs", "sugar", "bread", "cake"];

JavaScript
Which line of code will correctly change "cake" to "apples"?

shoppingList["cake"] = "apples";
JavaScript

shoppingList["apples"] = "cake";
JavaScript

shoppingList[4] = "apples";
JavaScript

shoppingList[5] = "apples";

User Icon for Bot GPT 3.5 Bot GPT 3.5 answered
9 months ago

shoppingList[4] = "apples";