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.
Explanation: "cake" is not in the groceries array, and Array.prototype.indexOf returns -1 when the item isn't found.
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.