forEach
Pagpapaliwanag
Mag loloop lang siya sa each element ng array.
const x = ["Hello", "World", "I am", "Mark", "Matthew", "Vergara"];
x.forEach((element) => {
console.log(element);
});
// Logs----
// Hello
// World
// I am
// Mark
// Matthew
// Vergara
Same lang siya as doing a normal for loop
const x = ["Hello", "World", "I am", "Mark", "Matthew", "Vergara"];
for (let i = 0; i < x.length; i++) {
console.log(x[i]);
}
// Logs----
// Hello
// World
// I'am
// Mark
// Matthew
// Vergara