The unchanging prefix should be computed once, not inside the loop.
Acceptance criteria
- 1.#out should show 1.
The unchanging prefix should be computed once, not inside the loop.
const items = ["a", "b"]; let computeCount = 0; const results = []; for (const item of items) { computeCount++; const prefix = "PREFIX-"; results.push(prefix + item); } document.querySelector('#out').textContent = String(computeCount);
Output ready when you are
Press Run to render your code, or Submit to validate your solution.