Answers for "using for in js"

220

javascript for 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
4

for in javascript

for (let i = start; i < end; i++) {

}
Posted by: Guest on October-05-2020
-1

for loop in js

for (let counter = 1; counter < 3; counter++) {

    // console.log(counter,'\n');       
}
Posted by: Guest on April-20-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language