You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
As of 1.2.21 (possibly before) forEach behaves differently to what it did in 1.2.18. Given an object with numeric keys, where some numbers are skipped, it now iterates also over those missing keys, so to speak.
…ing properties)
Array.prototype.forEach will not invoke the callback function if the properety is not present in the
object. Because of this, we have the illusion of not iterating over non-added properties in a sparse
array.
From ECMAScript:
9. Repeat while k < len
a. Let Pk be ToString(k).
b. Let kPresent be HasProperty(O, Pk).
c. ReturnIfAbrupt(kPresent).
d. If kPresent is true, then
i. Let kValue be Get(O, Pk)
... (steps for invoking the function and aborting if it throws)
Closesangular#8510Closesangular#8522
…ing properties)
Array.prototype.forEach will not invoke the callback function if the properety is not present in the
object. Because of this, we have the illusion of not iterating over non-added properties in a sparse
array.
From ECMAScript:
9. Repeat while k < len
a. Let Pk be ToString(k).
b. Let kPresent be HasProperty(O, Pk).
c. ReturnIfAbrupt(kPresent).
d. If kPresent is true, then
i. Let kValue be Get(O, Pk)
... (steps for invoking the function and aborting if it throws)
Closesangular#8510Closesangular#8522
caitp
added a commit
to caitp/angular.js
that referenced
this issue
Aug 7, 2014
…ing properties)
Array.prototype.forEach will not invoke the callback function if the properety is not present in the
object. Because of this, we have the illusion of not iterating over non-added properties in a sparse
array.
From ECMAScript:
9. Repeat while k < len
a. Let Pk be ToString(k).
b. Let kPresent be HasProperty(O, Pk).
c. ReturnIfAbrupt(kPresent).
d. If kPresent is true, then
i. Let kValue be Get(O, Pk)
... (steps for invoking the function and aborting if it throws)
Closesangular#8510Closesangular#8522
As of 1.2.21 (possibly before) forEach behaves differently to what it did in 1.2.18. Given an object with numeric keys, where some numbers are skipped, it now iterates also over those missing keys, so to speak.
The following code:
Produces an output of
["a", "b", "c"]
in 1.2.18 while in 1.2.21 now gives[undefined, "a", undefined, "b", undefined, "c"]
.Browser: Chrome 36
OS: Windows 8
Is this intentional? I noticed it because it breaks the angular-strap datepicker.
The text was updated successfully, but these errors were encountered: