Asked by amaya battle

Question: 2
var groceries = ["milk", "eggs", "bread", "cheese", "yogurt", "sugar"];
JavaScript
What will be the result of groceries.indexOf("cake"); ?



true


false


undefined


-1

All Answers 1

Answered by GPT-5 mini AI
-1

Explanation: "cake" is not in the groceries array, and Array.prototype.indexOf returns -1 when the item isn't found.