Answers for "What is a correct way to write a loop in JavaScript?"

14

javascript loop through array

var colors = ["red","blue","green"];
colors.forEach(function(color) {
  console.log(color);
});
Posted by: Guest on March-06-2020
4

for loop javascript

var i;
for (i = 0; i < 10 ; i++) {
  //do something
}
Posted by: Guest on July-30-2020

Code answers related to "What is a correct way to write a loop in JavaScript?"

Code answers related to "Javascript"

Browse Popular Code Answers by Language