Why is typeof null “object”?

前端 未结 8 1434
暗喜
暗喜 2020-11-22 04:51

I\'m reading \'Professional Javascript for Web Developers\' Chapter 4 and it tells me that the five types of primitives are: undefined, null, boolean, number and string.

8条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 05:25

    From the book YDKJS

    This is a long-standing bug in JS, but one that is likely never going to be fixed. Too much code on the Web relies on the bug and thus fixing it would cause a lot more bugs!

提交回复
热议问题