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.
I would agree, but it isn't something you'd expect. I was refactoring some code to use native for loops today and had tests suddenly fail because the previous forEach loop was silently failing when the array wasn't being defined.
Maybe it is supposed to fail silently by design, but I think that should be mentioned in documentation at the very least.
I'm going to close this because I don't think we're going to change this behaviour (although it's always possible I'm wrong) --- however you're welcome to submit a docs fix to indicate that forEach(undefined) is perfectly acceptable
Angular's implementation of forEach fails silently when passed and undefined reference. Example here: http://plnkr.co/3TrVkuC6mLi8pAapIWvn
Native implementations throw a TypeError when the reference is undefined: http://plnkr.co/2KfVwdIuRuno0DWwmV7N
The text was updated successfully, but these errors were encountered: