Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

How to Loop Through an Array with a do…while Loop in JavaScript

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

let i = 0;

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

// will return
// 22
// 54
// 76
// 92
// 43
// 33
Comment

PREVIOUS NEXT
Code Example
Javascript :: How to Loop Through an Array with a forEach Loop in JavaScript 
Javascript :: Backbone Template 
Javascript :: mogodb user get 
Javascript :: express get, post, delete, put template 
Javascript :: useEffect : react to manipulate the DOM 
Javascript :: adding number upto n , adding number, fastest number addding 
Javascript :: Javascript set control state none opposite 
Javascript :: jquery issue stack 
Javascript :: climbing stairs 
Javascript :: counter example using classes react without jsx 
Javascript :: Solution-1--solution options for reverse bits algorithm js 
Javascript :: how to receive form data in node js 
Javascript :: if statement js 
Javascript :: redirect router v6 
Javascript :: javascript get object methods 
Javascript :: mongoose query document 
Javascript :: .reverse javascript string 
Javascript :: implement the nationalize api using async/await with fetch. 
Javascript :: async await return promise 
Javascript :: = meaning in javascript 
Javascript :: how to convert roman to decimal in javascript 
Javascript :: ref.current.selectionStart 
Javascript :: what f a number exceeding 2^53 in javascript 
Javascript :: javascript modules 
Javascript :: JavaScript Data Privacy 
Javascript :: actionscript fibonacci fibonaccinumbers 
Javascript :: nodejs: http: router simple 
Javascript :: npm function-memoizer 
Javascript :: phaser place on triangle 
Javascript :: get lat long react native 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =