The forEach()
method is an iterative method. It calls a provided callbackFn
function once for each element in an array in ascending-index order. Unlike map()
, forEach()
always returns undefined
and is not chainable. The typical use case is to execute side effects at the end of a chain.
callbackFn
is invoked only for array indexes which have assigned values. It is not invoked for empty slots in sparse arrays.