Answers for "es6 foreach dom element"

2

es6 forEach

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

array1.forEach((element) => {
  console.log(element)
});

// expected output: "a"
// expected output: "b"
// expected output: "c"
Posted by: Guest on August-25-2020
0

es6 foreach dom element

//es6
Array.from(els).forEach((el) => {
});

//old shit
Array.prototype.forEach.call(els, function(el) {
    // Do stuff here
    console.log(el.tagName);
});

// Or
[].forEach.call(els, function (el) {...});
Posted by: Guest on April-14-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language