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
This commit is contained in:
Jeremiah Hoyet
2014-09-17 23:50:15 -04:00
committed by Caitlin Potter
parent 02aa4f4b85
commit 6502ab0977

View File

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