Answers for "how to do loop js"

220

js loop

var colors=["red","blue","green"];
for (let i = 0; i < colors.length; i++) { 
  console.log(colors[i]);
}
Posted by: Guest on June-17-2019
8

for loop javascript

var listItem = [
        {name: 'myName1', gender: 'male'},
        {name: 'myName2', gender: 'female'},
        {name: 'myName3', gender: 'male'},
        {name: 'myName4', gender: 'female'},
      ]

    for (const iterator of listItem) {
        console.log(iterator.name+ ' and '+ iterator.gender);
    }
Posted by: Guest on May-09-2020
0

javascript looping

for (let i = 0; i < cars.length; i++) {
  text += cars[i] + "<br>";
}
Posted by: Guest on July-21-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language