多种类型的 typeof
预测输出 入门
题目
这段代码打印什么?
代码
console.log(typeof 42, typeof "hi", typeof true, typeof undefined);
提示
每个 typeof 返回类型名字符串。
解释
typeof 42 为 "number",typeof "hi" 为 "string",typeof true 为 "boolean",typeof undefined 为 "undefined"。console.log 多参数时以空格分隔打印。输出为:number string boolean undefined
相关资源
相关课程
- 数据类型
学习基本数据类型。
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。