JavaScript Array forEach()
2022-05-12T03:44:44 - Vicky Chhetri
Read Time:13 Second
The forEach() method calls a function for each element in an array.
The forEach() method is not executed for empty elements.
const numbers = [65, 44, 12, 4];
numbers.forEach(myFunction)
function myFunction(item, index, arr) {
arr[index] = item * 10;
}