JavaScript para
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)
}
const array = ['a', 'b', 'c', 'd'];
for (const item of array) {
console.log(item)
}
// Result: a, b, c, d
const string = 'Ire Aderinokun';
for (const character of string) {
console.log(character)
}
// Result: I, r, e, , A, d, e, r, i, n, o, k, u, n
// for of loop
/*
for item of the menu console.log(current item)
*/
for (const item of menu){
console.log(item);
}
// array element and index
for (const item of menu.entries()){
console.log(item);
}