1.js里面typeof的写法
(1)在typeof后面直接跟括号,括号里面写具体参数。
console.log(typeof("a"));
(2)在typeof后面空格,然后跟具体参数。
console.log(typeof "a");

2.js里面typeof的返回数据类型
(1)number
(2)string
(3)Boolean
(4)undefined
(5)object
(6)function
(7)symbol(es6)
本文详细介绍了JavaScript中typeof操作符的两种用法及其返回的数据类型,包括number、string、Boolean、undefined、object和function。同时,提到了ES6新增的symbol类型。通过对typeof的理解,有助于开发者更好地进行类型检查和错误预防。
1.js里面typeof的写法
(1)在typeof后面直接跟括号,括号里面写具体参数。
console.log(typeof("a"));
(2)在typeof后面空格,然后跟具体参数。
console.log(typeof "a");

2.js里面typeof的返回数据类型
(1)number
(2)string
(3)Boolean
(4)undefined
(5)object
(6)function
(7)symbol(es6)
2万+

被折叠的 条评论
为什么被折叠?