Why is null an object and what's the difference between null and undefined?

后端 未结 22 1059
猫巷女王i
猫巷女王i 2020-11-22 02:58

Why is null considered an object in JavaScript?

Is checking

if ( object == null )
      Do something

the

22条回答
  •  时光说笑
    2020-11-22 03:33

    null is an object. Its type is null. undefined is not an object; its type is undefined.

提交回复
热议问题