javascript es6 foreach code example
Example 1: es6 forEach
const array1 = ['a', 'b', 'c'];
array1.forEach((element) => {
console.log(element)
});
Example 2: foreach jas
const array1 = ['a', 'b', 'c'];
array1.forEach(element => console.log(element));
Example 3: js for each item do
let array = ['Item 1', 'Item 2', 'Item 3'];
array.forEach(item => {
console.log(item);
});
Example 4: mdn foreach
arr.forEach(callback(currentValue [, index [, array]])[, thisArg])
Example 5: es6 foreach dom element
Array.from(els).forEach((el) => {
});
Array.prototype.forEach.call(els, function(el) {
console.log(el.tagName);
});
[].forEach.call(els, function (el) {...});
Example 6: foreach javascript
arr.forEach(callback(currentValue [, index [, array]])[, thisArg]);