【JS错题总结】JS中的typeof

发布时间 2023-06-14 22:02:30作者: zjy4fun
var test = 1.2
console.log(typeof test === 'float');// false
console.log(typeof test) // number

var test2 = '4399' - 0
console.log(typeof test2 === 'number') // true

var sym = Symbol(1)
console.log(typeof sym === 'symbol') // true

var bigint = BigInt(10000)
console.log(typeof bigint === 'bigint') // true

JS 中没有 float 这个数据类型!

 

typeof
undefined       
boolean           
string              
number          
object             
function         
symbol
bigint