Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 6502ab0

Browse files
Trendycaitp
authored andcommitted
doc(angular.forEach): note difference from ES262's Array.prototype.forEach
Since Angular's forEach is not a strict polyfill, and takes different paths depending on the type of collection it is dealing with, it does not throw a TypeError when converting the obj with ToObject(), as this operation does not need to be performed. This difference is documented nicely here. Closes #9142
1 parent 02aa4f4 commit 6502ab0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Angular.js

+5
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,11 @@ function isArrayLike(obj) {
221221
*
222222
* It is worth noting that `.forEach` does not iterate over inherited properties because it filters
223223
* using the `hasOwnProperty` method.
224+
*
225+
* Unlike ES262's
226+
* [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18),
227+
* Providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just
228+
* return the value provided.
224229
*
225230
```js
226231
var values = {name: 'misko', gender: 'male'};

0 commit comments

Comments
 (0)