“MDN foreach” Kode Jawaban

JavaScript foreach

const avengers = ['thor', 'captain america', 'hulk'];
avengers.forEach((item, index)=>{
	console.log(index, item)
})
connect.sonveer

JavaScript foreach

var colors = ['red', 'blue', 'green'];

colors.forEach(function(color) {
  console.log(color);
});
Grepper

JavaScript foreach

const products = [
    { name: 'Laptop', price: 32000, brand: 'Lenovo', color: 'Silver' },
    { name: 'Phone', price: 700, brand: 'Iphone', color: 'Golden' },
    { name: 'Watch', price: 3000, brand: 'Casio', color: 'Yellow' },
    { name: 'Aunglass', price: 300, brand: 'Ribon', color: 'Blue' },
    { name: 'Camera', price: 9000, brand: 'Lenovo', color: 'Gray' },
];
products.forEach(product => console.log(product.name));
//Output: Laptop Phone Watch Aunglass Camera
Ariful Islam Adil(Code Lover)

Foreach Jas

const array1 = ['a', 'b', 'c'];

array1.forEach(element => console.log(element));
Tame Turkey

JavaScript foreach

let numbers = ['one', 'two', 'three', 'four'];

numbers.forEach((num) => {
  console.log(num);
});  // one   //two //three // four
Batman

MDN foreach

var colors = ["red", "blue", "green"];
colors.forEach(function(color) {
    console.log(color);
});
Grepper

Jawaban yang mirip dengan “MDN foreach”

Pertanyaan yang mirip dengan “MDN foreach”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya