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 for…of Loop in JavaScript 
Javascript :: Backbone View Event 
Javascript :: Deployment of react static page using node and express 
Javascript :: geteliment by id in javascript 
Javascript :: Backbone Model Validation And Inheritance 
Javascript :: get the first recurring character javascript 
Javascript :: discord.js sync channel permissions 
Javascript :: sap rpa desktop studio activate excel macro 
Javascript :: Check if a number starts with another number or not js 
Javascript :: quill js laravel 
Javascript :: create number format excel react native 
Javascript :: java script strict mode 
Javascript :: var date = new Date(); 
Javascript :: how to check the validation of time in react datetime 
Javascript :: redirect in react-router-dom v6 
Javascript :: react js tutorial for beginners 
Javascript :: js return 
Javascript :: how to use npm package in javascript 
Javascript :: static in class javascript 
Javascript :: react native get screen height and width 
Javascript :: how to reverse sort lines in javascript 
Javascript :: express socket 
Javascript :: Convert to String Explicitly 
Javascript :: javascript Rethrow an Exception 
Javascript :: freecodecamp javascript basic step quoting string 
Javascript :: mui on node 
Javascript :: pyautogui javascript 
Javascript :: bring object to ckicked location 
Javascript :: phaser place on rectangle 
Javascript :: accessing-nested-javascript-objects-and-arrays-by-string-path 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =