From 6502ab09774e1ac310da90c9e1c49fb0cd652d66 Mon Sep 17 00:00:00 2001 From: Jeremiah Hoyet Date: Wed, 17 Sep 2014 23:50:15 -0400 Subject: [PATCH] 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 --- src/Angular.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Angular.js b/src/Angular.js index 7803b9de..d81da8a1 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -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'};