Continuing past the match records the last one instead of the first.
Acceptance criteria
- 1.#out should show index 1.
Continuing past the match records the last one instead of the first.
const items = [9, 5, 5, 7]; let found = -1; for (let i = 0; i < items.length; i++) { if (items[i] === 5) found = i; } document.querySelector('#out').textContent = "index " + found;
Output ready when you are
Press Run to render your code, or Submit to validate your solution.