×

Loading...

Topic

This topic has been archived. It cannot be replied.
  • 工作学习 / 学科技术 / 问个Javascript的问题:
    1.Why might it be unwise to determine whether an object is - or
    is not - null by comparing (assumption: with triple-equal
    equality operator) the value returned by typeof operator when
    used on the object to the string ‘object’?
    Consider the following code example:

    If(typeof myobj===’object’){

    }
    • 现学现卖。'object' 不是null独用的,不是null也会出这个结果。
    • 因为 console.log( typeof null ), output 'object'