Most programming languages contain good and bad parts, but JavaScript has more than its share of the bad, having been developed and released in a hurry before it could be refined. This authoritative book scrapes away these bad features to reveal a subset of JavaScript that's more reliable, readable, and maintainable than the language as a whole-a subset you can use to create truly extensible and efficient code. Considered the JavaScript expert by many people in the development community, author Douglas Crockford identifies the abundance of good ideas that make JavaScript an outstanding object-oriented programming language-ideas such as functions, loose typing, dynamic objects, and an expressive object literal notation. Unfortunately, these good ideas are mixed in with bad and downright awful ideas, like a programming model based on global variables. When Java applets failed, JavaScript became the language of the Web by default, making its popularity almost completely independent of its qualities as a programming language. In JavaScript: The Good Parts, Crockford finally digs through the steaming pile of good intentions and blunders to give you a detailed look at all the genuinely elegant parts of JavaScript, including:Syntax Objects Functions Inheritance Arrays Regular expressions Methods Style Beautiful features The real beauty? As you move ahead with the subset of JavaScript that this book presents, you'll also sidestep the need to unlearn all the bad parts. Of course, if you want to find out more about the bad parts and how to use them badly, simply consult any other JavaScript book. With JavaScript: The Good Parts, you'll discover a beautiful, elegant, lightweight and highly expressive language that lets you create effective code, whether you're managing object libraries or just trying to get Ajax to run fast. If you develop sites or applications for the Web, this book is an absolute must.
Author(s): Douglas Crockford
Edition: 1
Publisher: Yahoo Press
Year: 2008
Language: English
Pages: 172
Tags: Библиотека;Компьютерная литература;HTML / CSS / JavaScript;
Table of Contents......Page 9
Preface......Page 13
Safari® Books Online......Page 14
Acknowledgments......Page 15
Good Parts......Page 17
Why JavaScript?......Page 18
Analyzing JavaScript......Page 19
A Simple Testing Ground......Page 20
Whitespace......Page 21
Names......Page 22
Numbers......Page 23
Strings......Page 24
Statements......Page 26
Expressions......Page 31
Literals......Page 33
Functions......Page 35
Object Literals......Page 36
Retrieval......Page 37
Prototype......Page 38
Reflection......Page 39
Delete......Page 40
Global Abatement......Page 41
Function Objects......Page 42
Invocation......Page 43
The Function Invocation Pattern......Page 44
The Constructor Invocation Pattern......Page 45
The Apply Invocation Pattern......Page 46
Return......Page 47
Augmenting Types......Page 48
Recursion......Page 50
Scope......Page 52
Closure......Page 53
Module......Page 56
Cascade......Page 58
Curry......Page 59
Memoization......Page 60
Inheritance......Page 62
Pseudoclassical......Page 63
Prototypal......Page 66
Functional......Page 68
Parts......Page 71
Array Literals......Page 74
Length......Page 75
Enumeration......Page 76
Methods......Page 77
Dimensions......Page 79
Regular Expressions......Page 81
An Example......Page 82
Construction......Page 86
Regexp Sequence......Page 88
Regexp Escape......Page 89
Regexp Group......Page 90
Regexp Class......Page 91
Regexp Quantifier......Page 92
Array......Page 94
Number......Page 100
RegExp......Page 102
String......Page 104
Style......Page 110
Beautiful Features......Page 114
Global Variables......Page 117
Semicolon Insertion......Page 118
typeof......Page 119
Floating Point......Page 120
Phony Arrays......Page 121
Falsy Values......Page 122
Object......Page 123
==......Page 125
eval......Page 126
Block-less Statements......Page 127
Bitwise Operators......Page 128
The function Statement Versus the function Expression......Page 129
void......Page 130
JSLint......Page 131
Members......Page 132
Options......Page 133
Line Breaking......Page 134
Forbidden Blocks......Page 135
var Statement......Page 136
== and !=......Page 137
eval Is Evil......Page 138
Not Looked For......Page 139
Report......Page 140
Syntax Diagrams......Page 141
JSON Syntax......Page 152
Using JSON Securely......Page 155
A JSON Parser......Page 156
Index......Page 163