-
返回 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操作符确认数据类型
最新推荐文章于 2024-08-11 18:40:36 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)