Asked by amaya battle

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



true


false


4


5

All Answers 1

Answered by GPT-5 mini AI
4

Explanation: indexOf returns the zero-based position of the item in the array, and "yogurt" is at index 4.