JavaScript语言精粹(修订版) = JavaScript:The Good Parts

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

JavaScript 曾是“世界上最被误解的语言”,因为它担负太多的特性,包括糟糕的交互和失败的设计,但随着Ajax 的到来,JavaScript“从最受误解的编程语言演变为最流行的语言”,这除了幸运之外,也证明了它其实是一门优秀的语言。Douglas Crockford 在本书中剥开了JavaScript 沾污的外衣,抽离出一个具有更好可靠性、可读性和可维护性的JavaScript 子集,让你看到一门优雅的、轻量级的和非常富有表现力的语言。作者从语法、对象、函数、继承、数组、正则表达式、方法、样式和优美的特性这9 个方面来呈现这门语言真正的精华部分,通过它们完全可以构建出优雅高效的代码。作者还通过附录列出了这门语言的毒瘤和糟粕部分,且告诉你如何避免它们。最后还介绍了JSLint,通过它的检验,能有效地保障我们的代码品质。 这是一本介绍 JavaScript 语言本质的权威书籍,值得任何正在或准备从事JavaScript 开发的人阅读,并且需要反复阅读。学习、理解、实践大师的思想,我们才可能站在巨人的肩上,才有机会超越大师,这本书就是开始。

Author(s): Douglas Crockford
Series: O’reilly系列
Publisher: 电子工业出版社
Year: 2012

Language: Chinese
Pages: 155
Tags: JavaScript

前言................................................................................................................................xv
第1 章 精华.................................................................................................................. 1
为什么要使用JavaScript .......................................................................................................2
分析JavaScript......................................................................................................................2
一个简单的试验场.................................................................................................................4
第2 章 语法.................................................................................................................. 5
空白.......................................................................................................................................5
标识符...................................................................................................................................6
数字.......................................................................................................................................7
字符串...................................................................................................................................8
语句.....................................................................................................................................10
表达式.................................................................................................................................15
字面量.................................................................................................................................18
函数.....................................................................................................................................19
第3 章 对象................................................................................................................ 20
对象字面量..........................................................................................................................20
检索.....................................................................................................................................21
更新.....................................................................................................................................22
引用.....................................................................................................................................22
原型.....................................................................................................................................22
反射.....................................................................................................................................23
枚举.....................................................................................................................................24
删除.....................................................................................................................................24
减少全局变量污染...............................................................................................................25
第4 章 函数................................................................................................................ 26
函数对象..............................................................................................................................26
函数字面量..........................................................................................................................27
调用.....................................................................................................................................27
参数.....................................................................................................................................30
返回.....................................................................................................................................31
异常.....................................................................................................................................31
扩充类型的功能...................................................................................................................32
递归.....................................................................................................................................33
作用域.................................................................................................................................36
闭包.....................................................................................................................................36
回调.....................................................................................................................................39
模块.....................................................................................................................................40
级联.....................................................................................................................................42
柯里化.................................................................................................................................43
记忆.....................................................................................................................................43
第5 章 继承................................................................................................................. 46
伪类.....................................................................................................................................46
对象说明符..........................................................................................................................49
原型.....................................................................................................................................50
函数化.................................................................................................................................51
部件.....................................................................................................................................55
第6 章 数组................................................................................................................. 57
数组字面量..........................................................................................................................57
长度.....................................................................................................................................58
删除.....................................................................................................................................59
枚举.....................................................................................................................................59
容易混淆的地方...................................................................................................................60
方法.....................................................................................................................................60
指定初始值..........................................................................................................................62
第7 章 正则表达式..................................................................................................... 64
一个例子..............................................................................................................................65
结构.....................................................................................................................................69
元素.....................................................................................................................................71
第8 章 方法................................................................................................................. 77
Array ....................................................................................................................................77
Function ...............................................................................................................................83
Number ................................................................................................................................84
Object...................................................................................................................................85
RegExp ................................................................................................................................86
String....................................................................................................................................88
第9 章 代码风格........................................................................................................ 94
第10 章 优美的特性................................................................................................... 98
附录A 毒瘤............................................................................................................... 101
附录B 糟粕............................................................................................................... 109
附录C JSLint ............................................................................................................. 115
附录D 语法图........................................................................................................... 127
附录E JSON............................................................................................................... 138
索引.............................................................................................................................. 149