What is the benefit of angular.isdefined over and above foo === undefined?
I can\'t immediately think of a benefit.
I can only guess but I think my guess is a pretty good one.
These two expressions are functionally equivalent:
typeof foo !== 'undefined'
angular.isDefined(foo)
Benefits of the latter include:
1) It's arguably less of a mental strain to ask whether something is defined than to ask if something is not undefined.
2) angular.isDefined(foo) is arguably a lot less "noisy" than typeof foo !== 'undefined', and therefore it's quicker to grasp what's happening.
Note: These aren't my arguments for the superiority of angular.isDefined. What I'm trying to convey is my guess as to why the Angular team wanted to create angular.isDefined and why they thought it was better than the plain JavaScript alternative.