本章是引言,有四个小节,具体内容如下:
第一小节
第一小节介绍作者的观点,作者编写本书的目的。
原文:I discovered that I could be a better programmer by using only the good part And avoiding the bad part。(简述为取其精华去其糟粕)
原文:My Intention here is to expose the goodness in javascript, an outstanding,Dynamic language,Javascript is a block of marble,and I chip away the features that are not beautiful until the language’s true nature reveals itself. I believe that the elegant subset I carved out is vastly superior to the language as a whole. Being more reliable, readable, and maintainable.(本书的目的是发现语言中的精华部分,写出更优秀的代码)
第二小节
为什么必须是JS语言?
答:因为它与浏览器绑定在一起,你没有其他选择;JS语言本身功能强大,容易上手,即使对语言较为陌生,也可以编写代码。Java也是如此,上手容易,深入非常难。
第三小节
第三小节简述语法中的good part 和bad part
Good part
- 弱语言类型,动态添加属性
- 字面量,创建任意的数据类型可以直接使用字面量。
- Prototype:原型链。
Bad part
- 全局变量
- 没有块作用域(在ES6中已经改善)
第四小节
第四小节初体验,编写Hello world