javascript pour
const array = ['hello', 'world', 'of', 'Corona'];
for (const item of array) {
console.log(item);
}
2 Programmers 1 Bug
const array = ['hello', 'world', 'of', 'Corona'];
for (const item of array) {
console.log(item);
}
let arr = ["a", "b", "c"]
for (let i in arr){
console.log(i) // 0, 1, 2
}
for(let i of arr){
console.log(i) // a, b, c
}
const array1 = ['a', 'b', 'c'];
for (const element of array1) {
console.log(element);
}
Create a loop that runs through each item in the fruits array.
var fruits = ['Apple', 'Banana', 'Orange']
for (x of fruits){
console.log(x)
}
let list = [10, 11, 12];
for (let i in list) {
console.log(i); //Display the indices: "0", "1", "2",
}
for (let i of list) {
console.log(i); // Display the elements: "10", "11", "12"
}
(function() {
for (const argument of arguments) {
console.log(argument);
}
})(1, 2, 3);
// 1
// 2
// 3