Answers for "for loop javascript syntax"

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
31

javascript loop

let array = ['Item 1', 'Item 2', 'Item 3'];

array.forEach(item => {
	console.log(item); // Logs each 'Item #'
});
Posted by: Guest on February-20-2020
1

for loop in javascript

For printing 0 to 9

you can write like below also
var i;
for (i = 0; i < 10; i++) {
  console.log(i);
}
Posted by: Guest on February-20-2021
0

JavaScript For Loop

for (var i = 0; i < 4; i++) {
 
}
Posted by: Guest on July-11-2021
5

javascript loop

var colors=["red","blue","green"];
for(let color of colors){
  console.log(color)
}
Posted by: Guest on December-06-2019
-1

javascript loop

{"coord":{"lon":69.4167,"lat":34.5},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"base":"stations","main":{"temp":294.37,"feels_like":293.07,"temp_min":294.37,"temp_max":294.37,"pressure":1008,"humidity":20,"sea_level":1008,"grnd_level":811},"visibility":10000,"wind":{"speed":1.72,"deg":278,"gust":1.88},"clouds":{"all":0},"dt":1624587596,"sys":{"type":1,"id":7381,"country":"AF","sunrise":1624579865,"sunset":1624631919},"timezone":16200,"id":1138957,"name":"Kabul","cod":200}
Posted by: Guest on June-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language