typeof 运算符返回一个用来表示表达式的数据类型的字符串。 
可能的字符串有:"number"、"string"、"boolean"、"object"、"function" 和 "undefined"。 

常用返回值说明

 

 

表达式 返回值
typeof undefined 'undefined'
typeof null 'object'
typeof true 'boolean'
typeof 123 'number'
typeof "abc" 'string'
typeof function() {} 'function'
typeof {} 'object'
typeof [] 'object'
typeof unknownVariable 'undefined'

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2021-10-04
  • 2021-12-18
  • 2021-12-31
相关资源
相似解决方案