“untuk di JS” Kode Jawaban

JS Loop melalui objek

const obj = { a: 1, b: 2 };

Object.keys(obj).forEach(key => {
	console.log("key: ", key);
  	console.log("Value: ", obj[key]);
} );
GreekLover

JS Loop Over Object

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

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

BOUCLE UNTUK JAVASCRIPT

var i=0; 
for (i=0;i<=6;i++){
document.write("Le nombre est :  " + i);
document.write("<br />");
}
Silly Sheep

JavaScript untuk

const array = ['hello', 'world', 'of', 'Corona'];

for (const item of array) {
  console.log(item);
}
2 Programmers 1 Bug

untuk di JS

var colors=["red","blue","green"];
for(let col of colors){
  console.log(col);
}
// red
// blue
// green
Dead Dormouse

JavaScript untuk Loop

//pass an array of numbers into a function and log each number to the console
function yourFunctionsName(arrayToLoop){
  
  //Initialize 'i' as your counter set to 0
  //Keep looping while your counter 'i' is less than your arrays length 
  //After each loop the counter 'i' is to increased by 1
  for(let i = 0; i <arrayToLoop.length; i++){
    	
    	//during each loop we will console.log the current array's element
    	//we use 'i' to designate the current element's index in the array
    	console.log(arrayToLoop[i]) 
    }
}

//Function call below to pass in example array of numbers
yourFunctionsName([1, 2, 3, 4, 5, 6]) 
Michael Futral

Jawaban yang mirip dengan “untuk di JS”

Pertanyaan yang mirip dengan “untuk di JS”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya