-
返回 number
typeof 1
typeof new Date().getTime() -
返回 undefiend
typeof undefined
typeof console.log(1); 先打印1,再打印 undefined -
返回 string
typeof ' '
typeof '1'
typeof typeof null -
返回 boolean
typeof false
typeof true
typeof ( 1 == 1 ) -
返回 function
typeof function() {}
typeof Object
typerof Number
typeof Array
typeof String -
返回Object
typeof null
typeof {}
typeof []
typeof new Array()
typeof new Object()
typeof new Number()
class A{} typeof new A() -
返回 symbol
typeof Symbol('name')
JavaScript typeof操作符确认数据类型
最新推荐文章于 2025-12-31 16:31:20 发布
本文详细解释了JavaScript中的typeof运算符,展示了不同数据类型(如number,string,undefined,boolean,object,function,null,Symbol等)的typeof值,以及类的声明和新实例化对象的typeof检查。
295

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



