Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to Loop Through an Array with a While Loop in JavaScript

const scores = [22, 54, 76, 92, 43, 33];

let i = 0;

while (i < scores.length) {
    console.log(scores[i]);
    i++;
}

// will return
// 22
// 54
// 76
// 92
// 43
// 33
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #How #Loop #Through #Array #While #Loop #JavaScript
ADD COMMENT
Topic
Name
7+4 =