_.each

Iterates over a list of elements, yielding each in turn to an iteratee function.

  1. // Underscore/Lodash
  2. _.each([1, 2, 3], function (value, index) {
  3. console.log(value)
  4. })
  5. // output: 1 2 3
  6.  
  7. // Native
  8. [1, 2, 3].forEach(function (value, index) {
  9. console.log(value)
  10. })
  11. // output: 1 2 3

Browser Support for Array.prototype.forEach()

ChromeEdgeFirefoxIEOperaSafari
1.5 ✔9.0 ✔