JS题目知识点总结(3)

212 阅读1分钟

1、真值假值

JavaScript中只有6个假值:

  • undefined
  • null
  • NaN
  • 0
  • '' (empty string)
  • false

函数构造函数,如new Numbernew Boolean都是真值。

2、

typeof 1 返回 "number". typeof "number" 返回 "string"

eg.console.log(typeof typeof 1);

返回string