变量的命名规则

  1. 1、变量不能以数字开头
  2. 2、不能包含运算符

null,undefined

  1. var a
  2. 没有赋值就是undefined
  3. var b = null
  4. null就是空,不占空间(内存中的垃圾回收机制会定时清理null的空间,但不是立即清理,会有一定的延迟)

特殊字符与数字比较

  1. 1、==运算中null的特殊情况
  2. null在==运算中,不会转换成number,它不等于任何值
  3. null转换为数字型是0,但是null与任何数字进行比较都是false
  4. null == undefined //true
  5. undefined转换为数字型是NaN
  6. console.log(Boolean(null));
  7. console.log(null==0);
  8. console.log(null==false);
  9. console.log(Number(null));
  10. console.log(Number(undefined));