Basic JavaScript: Iterate Through an Array with a For Loop | freeCodeCamp.org

EMBED

Mon Oct 03 2022 22:29:59 GMT+0000 (Coordinated Universal Time)

Saved by @chymax030 #javascript


// Setup const myArr = [2, 3, 4, 5, 6]; // Only change code below this line let total = 0; for (let i = 0; i < myArr.length; i++) { total += myArr[i]; }

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop