获取变量类型,有五种结果:

  • number
  • string
  • undefined
  • boolean
  • object
  • function

typeof null 的结果是 object;typeof 数组的结果是 object:typeof [1, 2, 4] === "object"