Confusion between isNaN and Number.isNaN in javascript

前端 未结 4 1638
悲哀的现实
悲哀的现实 2020-11-29 08:13

I have a confusion in how NaN works. I have executed isNaN(undefined) it returned true . But if I will use Number.isNaN(undefined) it

4条回答
  •  长情又很酷
    2020-11-29 08:47

    In shortly,

    isNaN()

    will check if the convert of value to Number (type) are failed

    For example'abc'


    Number.isNaN()

    will check if the given value type is Number but not valid number

    For example: 'bb'/33

提交回复
热议问题