Answers for "a for 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
0

for in js loop

Example:
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"


Syntax:
for (variable in object)
  statement
Posted by: Guest on February-22-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language