While reviewing the code in angular 1.3.4 for angular.forEach, I noticed the following implementation...
function forEach(obj, iterator, context) {
...
for (key = 0, length = obj.length; key < length; key++) {
if (isPrimitive || key in obj) {
iterator.call(context, obj[key], key, obj);
}
...
return obj;
}
However, a discussion on this link suggests that using decrement is faster. Should I consider switching to a pure javascript for loop? Why does the Angular team increment if performance is an issue? Is there a way, aside from rewriting, to optimize angular.forEach for this purpose?