读js语言精粹 - tianlu1677/tianlu1677.github.io GitHub Wiki

重点内容:

  1. 空白

  2. 不可用标识符做变量,同时包括一些常见的保留字, 如NaN null

  3. 64位浮点数,没有整数, 1.0 === 1, 同时Math方法有用

  4. 字符串是16位的

  5. false , null , undefined , ' ' , 0 , NaN 这些是false,其他都是为true

  6. number string boolean undefined function object 通过typeof来产生

  7. && 运算符,a &&b, 如果 a为假 则结果为 a, 否则为b

  8. 对象字面量的检索方式: 通过 . 来检索,如果不存在则为 undefined

  9. obj.hasOwnProperty(prop) 只检测自己特有的属性

  10. js中的数组不是真正的数组,而是用数字字符串做下标的对象。但是继承的是Function.prototype

  11. 最好不要用数组的length来计算长度,他是最大下标 + 1

  12. 删除数组时用 array.splice(2, 1)

  13. 不要在使用数组的时候使用对象

14.继承 js是继承与原型的,所以js是可以从对象中直接继承。