Array.prototype.forEach() | jQuery array each
forEach()executestheprovidedcallbackonceforeachelementpresentinthearrayinascendingorder.Itisnotinvokedforindexpropertiesthathavebeendeletedorareuninitialized(i.e.onsparsearrays).callbackisinvokedwiththreearguments:theelementvaluetheelementindexthearraybeingtraversedIfathisArgparameterisprovidedtoforEach(),itwillbeusedascallbacksthisvalue.Otherwise,thevalueundefined[1]willbeusedasitsthisvalue.Thethisvalueultimatelyobservablebycallbackisdeterminedaccordingtotheusualrulesfordeterminingthethisse...
forEach() executes the provided callback once for each element present in the array in ascending order. It is not invoked for index properties that have been deleted or are uninitialized (i.e. on sparse arrays).
callback is invoked with three arguments:
the element value the element index the array being traversedIf a thisArg parameter is provided to forEach(), it will be used as callbacks this value. Otherwise, the value undefined[1] will be used as its this value. The this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function[2].
The range of elements processed by forEach() is set before the first invocation of callback. Elements that are appended to the array after the call to forEach() begins will not be visited by callback. If the values of existing elements of the array are changed, the value passed to callback will be the value at the time forEach() visits them; elements that ar...