Fe-interview: Day21:写出执行结果,并解释原因

Created on 22 Jun 2020  ·  1Comment  ·  Source: lgwebdream/FE-Interview

[typeof null, null instanceof Object]

每日一题会在下午四点在交流群集中讨论,五点小程序中更新答案
欢迎大家在下方发表自己的优质见解
二维码加载失败可点击 小程序二维码

扫描下方二维码,收藏关注,及时获取答案以及详细解析,同时可解锁800+道前端面试题。

Most helpful comment

答案
[object, false]

解析

1) typeof 返回一个表示类型的字符串.

  • typeof 的结果列表

    • Undefined "undefined"

    • Null "object"

    • Boolean "boolean"

    • Number "number"

    • String "string"

    • Symbol "symbol"

    • Function "function"

    • Object "object"

2)instanceof 运算符用来检测 constructor.prototype 是否存在于参数 object 的原型链上.

>All comments

答案
[object, false]

解析

1) typeof 返回一个表示类型的字符串.

  • typeof 的结果列表

    • Undefined "undefined"

    • Null "object"

    • Boolean "boolean"

    • Number "number"

    • String "string"

    • Symbol "symbol"

    • Function "function"

    • Object "object"

2)instanceof 运算符用来检测 constructor.prototype 是否存在于参数 object 的原型链上.

Was this page helpful?
0 / 5 - 0 ratings