@@ -208,9 +208,9 @@ function isArrayLike(obj) {
208208 *
209209 * @description
210210 * Invokes the `iterator` function once for each item in `obj` collection, which can be either an
211- * object or an array. The `iterator` function is invoked with `iterator(value, key)`, where `value`
212- * is the value of an object property or an array element and `key` is the object property key or
213- * array element index. Specifying a `context` for the function is optional.
211+ * object or an array. The `iterator` function is invoked with `iterator(value, key, obj )`, where `value`
212+ * is the value of an object property or an array element, `key` is the object property key or
213+ * array element index and obj is the `obj` itself . Specifying a `context` for the function is optional.
214214 *
215215 * It is worth noting that `.forEach` does not iterate over inherited properties because it filters
216216 * using the `hasOwnProperty` method.
@@ -238,19 +238,19 @@ function forEach(obj, iterator, context) {
238238 // Need to check if hasOwnProperty exists,
239239 // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
240240 if ( key != 'prototype' && key != 'length' && key != 'name' && ( ! obj . hasOwnProperty || obj . hasOwnProperty ( key ) ) ) {
241- iterator . call ( context , obj [ key ] , key ) ;
241+ iterator . call ( context , obj [ key ] , key , obj ) ;
242242 }
243243 }
244244 } else if ( obj . forEach && obj . forEach !== forEach ) {
245245 obj . forEach ( iterator , context ) ;
246246 } else if ( isArrayLike ( obj ) ) {
247247 for ( key = 0 , length = obj . length ; key < length ; key ++ ) {
248- iterator . call ( context , obj [ key ] , key ) ;
248+ iterator . call ( context , obj [ key ] , key , obj ) ;
249249 }
250250 } else {
251251 for ( key in obj ) {
252252 if ( obj . hasOwnProperty ( key ) ) {
253- iterator . call ( context , obj [ key ] , key ) ;
253+ iterator . call ( context , obj [ key ] , key , obj ) ;
254254 }
255255 }
256256 }
0 commit comments