forEach in JavaScript and Libraries
Library | Method | Applies To | Method Signarture | Callback Signature | this arg | Return value | To exit early |
---|---|---|---|---|---|---|---|
JavaScript | Array.prototype.forEach | Array | (callback, [thisArg]) | (value, index, array) | thisArg |
undefined |
throw exception |
Underscore | _.each _.forEach |
Array Object |
(list, iteratee, [context]) | (element, index, list) (value, key, list) |
context |
list |
throw exception |
Lodash | _.each _.forEach |
Array Object |
(collection, [iteratee=_.identity]) | (value, index, collection) (value, key, collection) |
use _.bind in v4,thisArg in v3 |
collection |
return false |
jQuery | jQuery.each | Array Object |
(array, callback) (object, callback) |
(indexInArray, value) (propertyName, valueOfProperty) |
value valueOfProperty |
array object |
return false |