What is the benefit of angular.isdefined?

后端 未结 4 1723
走了就别回头了
走了就别回头了 2021-02-02 05:15

What is the benefit of angular.isdefined over and above foo === undefined?

I can\'t immediately think of a benefit.

4条回答
  •  温柔的废话
    2021-02-02 05:34

    Here is the source:

    function isDefined(value) {return typeof value !== 'undefined';}
    

    Obviously the first reason is a lower verbosity, but it also future proofs angular, especially if the function is used internally.

提交回复
热议问题