Answers for "forin loop javascript"

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
2

for in js

//for ... in statement

const object = { a: 1, b: 2, c: 3 };

for (const property in object) {
  console.log(`${property}: ${object[property]}`);
}

// expected output:
// "a: 1"
// "b: 2"
// "c: 3"
Posted by: Guest on September-15-2021
0

for loop in javascript

const numbers = [3, 4, 8, 9, 2];
for (let i = 0; i < numbers.length; i++) {
    const accessNumbers = numbers[i];
    console.log(accessNumbers);
}
//Expected output:3 4 8 9 2
Posted by: Guest on September-16-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language