Starting at the first value makes every range need a special case.
Acceptance criteria
- 1.#out should show 0-3-4-8.
Starting at the first value makes every range need a special case.
const items = [3, 1, 4]; const prefix = [items[0]]; for (let i = 1; i < items.length; i++) prefix[i] = prefix[i - 1] + items[i]; document.querySelector('#out').textContent = prefix.join("-");
Output ready when you are
Press Run to render your code, or Submit to validate your solution.