Predict typeof for 空
预测输出 中等
题目
什么做 这个 code print?
代码
console.log(typeof null);
提示
这个是 famous JavaScript quirk 那个有 existed 由于开头.
解释
In JavaScript, typeof 空 returns "对象" — this is a well-known bug/quirk that has been in the language since its creation and cannot be fixed without breaking existing code. Despite null being a primitive, typeof reports it as "对象".
相关资源
相关课程
- 数据类型
学习关于基本数据类型 in programming.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。