Index

Symbols

*, 10

~, 10

(, 25

!!, 151

==, 1519

===, 17, 19

$, 169

%, 10

&, 10

&&, 13

+, 10, 1214, 17, 25

++, 2425

-, 10, 25

--, 2425

., 28

<<, 10

>>, 10

>>>, 10

/, 25

;, 1925

^, 10

|, 10

||, 13, 147, 151, 153

•, 185186

, (expression sequencing operator), 55

[ ], 25, 107

A

Actors, 101

Actual argument, 67

add, 160163

addChild, 9697

addClass, 169

addEntry, 65

ai.js, 187188

allKeys, 125126

Anonymous function expressions, 41, 4750, 60, 74

append, 6667

apply, 6567

Argument creep, 149

Arguments

options object, 149153

order, 143144

self-documenting, 149

and variadic functions, 6772

arguments object, 35, 46, 6772, 7981, 138140, 146, 148

Arithmetic operators, 7, 10

Array [[Class]], 107109

Array constructor, 140141

Array.isArray, 162

Array-like objects, 138140, 160164, 166

Array.prototype, 110111

Arrays, 113116, 123125

associative, 114

concatenation, 139140

every method, 137138

filter method, 111, 135, 168

forEach method, 21, 7273, 75, 108, 111, 128, 130131, 134138, 162, 191, 193194

iteration, 132138

literals, 140141

map method, 61, 7475, 98100, 111, 134135, 137, 139, 168

some method, 137138

testing, 162163

Asynchronous APIs, 171175, 182

Asynchronous callbacks, 194197

Asynchronous loops, 183186

Automatic semicolon insertion, 19, 24

B

Backward compatibility, 3

Basic Multilingual Plane (BMP), 2628

bind, 7275, 177

Binding occurrence, 99100

Bit vectors, 160, 165

Bitwise arithmetic operators, 78, 10

Block scoping, 42

Blocking APIs, 174175

Blocking function, 172

Block-local functions, 5052

Boolean [[Class]], 108109

break, 2425

buffer, 6667, 7274

Bullet symbol (•), 185186

C

Cached files, 195197

call, 6365, 119122, 138140

Call stack, 184186

Call stack inspection, 7981

Callback function, 60, 62, 65, 7273, 99100, 175179

Chainable API, 168169

checkPassword, 8486, 9293, 95

choose, 199

[[Class]] internal property, 107109

Classes, 8687

Closures, 3941, 7577, 9495, 176

Code point, 2529

Code unit, 2629

Coercion, 914, 18, 164167

Comma-separated values (CSV), 98100

Comments, 149

concat, 139140

Concatenation, 35, 2223, 139140

Concurrency

asynchronous callbacks, 194197

counter and data race, 190194

error handling, 179183

event queue, 172175, 186190

nested callbacks, 175179

promises, 197200

recursion, 183186

const, 2

constructor, 140141

Constructors, 5759, 91

Context (graphics), 101

continue, 2425

Countdown, 184186

Counter and data race, 190194

C.prototype, 83, 87

CSV (comma-separated values), 98100

Curry, Haskell, 75

Currying, 75

D

Data race, 192, 198

Date [[Class]], 106, 108109

Debugging, 48, 105, 182

decodeURI, 28

decodeURIcomponent, 28

Defensive programming, 165

Deferreds, 197

Diagnostic information, 105

Dict, 118122, 130, 195196

Dictionaries, 113116, 123125

Direct eval, 5455

displayPage, 157159

“Do what I mean” semantics, 17

Double negation pattern (!!), 151

Double-precision floating-point, 79

downloadAllAsync, 178179, 181182, 190194

downloadAsync, 173178, 180184, 195

downloadCachingAsync, 195196

downloadFiles, 177178

downloadOneAsync, 183186

downloadOneSync, 183

downloadSync, 172

downloadURL, 177

Dropped errors, 179183

Duck testing, 161

Duck typing, 159

Duplicate code, 61, 180

Dynamic typing, 159

E

ECMAScript standard, 12, 19, 28, 55, 77, 106108

Edition 5 (ES5), 1, 3, 134135, 162

enable, 160165

encodeURI, 28

encodeURIcomponent, 28

Enumerable properties, 125127

Enumeration, 114117, 123132

Error [[Class]], 108109

Error-handling callbacks, 180181

Errors, 179183

Escape sequences, 168

eval function, 5255

Event loop, 173

Event queue, 171, 172175, 186190

Event-loop concurrency, 171

Eventual values, 198200

every, 137138

Exceptions, 44, 136, 179180, 196197

Expression sequencing operator (,), 55

extend function, 151153

F

Falsy, 1314

filter, 111, 135, 168

fillText, 154155

Fixed-arity, 65, 6768

Floating-point arithmetic, 124

Floating-point numbers, 79

Fluent style, 169

for loop, 2425, 132134

forEach, 21, 6465, 7273, 75, 108, 111, 128, 130131, 134138, 162, 191, 193194

for...in loop, 113116, 128129, 132

Formal parameter, 67

Formatters, 157159

Function [[Class]], 106, 108109

Function declaration, 47

Function expression, 41, 4750

Functions, 5759

apply method, 6567

arguments object, 35, 46, 6772, 7981, 138140, 146, 148

bind method, 7275, 177

call method, 6365, 119122, 138140

call stack inspection, 7981

closures, 7577

higher-order, 6063

toString method, 7778

Futures, 197

G

Generic array methods, 138140

getAuthor, 157159

getCallStack, 7980

getTitle, 157159

Global variables, 3134

guard, 165167

H

hasOwnProperty, 64, 109, 115122

Height/width, 143144, 150

Higher-order functions, 6063

highlight, 145146

Hoisting, 4244

hostname, 147

html method, 169

I

Identification number, 105106

Image data, 102

Immediately invoked function expressions (IIFE), 5, 6, 4446

Implementation inheritance, 83, 109

Implicit binding, 98100

Implicit coercions, 914

Index, 138139

Indirect eval, 5455

Inheritance, 8385, 89, 104, 108109, 118, 158159

ini object, 155156

inNetwork, 189

Instance properties, 103

Instance state, 9598

instanceof operator, 162

Integer addition, 125

Introspection, 109

isNaN, 11

isReallyNaN, 12

Iterator, 7071

J

join, 198

jQuery, 169

JSON [[Class]], 108

JSON data format, 33

L

Last-in, first out, 185186

length, 132133, 138139, 166

Lexical environment, 3637

Lexical scope, 42, 122

Library, 143144

Lightweight dictionaries, 113116

line.split, 99100

lint tools, 3435

Literals, 140141

Local variables, 3435, 5254

Logical OR operator (||), 147, 150151

Lookup, 118119

Loops, 183186

M

map, 61, 7475, 98100, 111, 134135, 137, 139, 168

Math [[Class]], 108

me, 100

MediaWiki, 157158

Merging function, 151

Methods, 5859

chaining, 167170

storing on prototypes, 9294

Mock object, 159

modal, 149152

Module systems, 6

Monkey-patching, 110111

moveTo, 102

N

Named function expression, 47

Naming conventions, 143144

NaN (not a number), 11

Nested callbacks, 175179

Nested function declaration, 52

Nested functions, 7172

new, 59, 83, 8991

newline, 19, 2425

next, 189

Node.js, 181

NodeList, 138140

Nonblocking APIs, 172

Nondeterminism, 130132, 192

Nonstandard features, 23

null, 146

Number [[Class]], 108

O

Object [[Class]], 108

Object extension function, 151153

Object introspection, 109

Objects as scopes, 49

Object wrappers, 1516

Object.create, 8991, 103105, 116117

Object.defineProperty, 126127

Object.getPrototypeOf, 8388, 109

Object.prototype, 115116, 118122, 125127

Objects, 127132, 138140

hasOwnProperty method, 64, 109, 115122

toString method, 1214, 1718, 107, 163

Operators

arithmetic, 7, 10, 21

bitwise, 89, 166

bitwise arithmetic, 10

expression sequencing (,), 55

typeof, 7, 14, 165166

Optional arguments, 149150

Options object, 149153

or, 166167

Order dependencies, 123125

Overloading structural types, 161

P

Page class, 158159

pick, 130131

Pollution of objects, 87

Polyfill, 111

Positional arguments, 149150

postMessage, 187189

Predicates, 135, 137

Primitives, 1518

Private data, 9495, 106

Profiling, 105

Promises, 197200

Property descriptor map, 116117

Property names, 105106

__proto__, 8384, 8689, 109, 117, 121

Prototype pollution, 115122

Prototypes

C.prototype, 83, 87

as implementation detail, 109110

instance state, 9598

Object.getPrototypeOf, 8388

__proto__, 8384, 8689, 109, 117, 121

storing methods on, 9294

Q

Querying web pages, 169

R

Radix, 8

Receiver, 5859, 6365, 7273

Recursion, 183186

RegExp, 108109

removeClass, 169

replace, 167168

Restricted productions, 24

return, 2425, 91

Run-to-completion guarantee, 172, 175

S

Scene graph, 101

Scope, 31

anonymous and named function expressions, 4750

block-local functions, 5052

closures, 3941

eval function, 5255

global variables, 3134

hoisting, 4244

immediately invoked function expressions (IIFE), 5, 6, 4446

local variables, 3435

with statement, 3539

Scope chain, 36

Security, 79, 9495

select, 199200

self, 9091, 100, 167

Self-documenting arguments, 149

Semicolon, 1925

setSection, 155156

setTimeout, 189191, 196

shift, 6869

Shift operators, 10

Short-circuiting methods, 137

Single character pattern, 28

slice, 70, 140

some, 137138

sort, 60

Source object, 151153

split, 110

Stack inspection, 7981

Stack overflow, 185

Stack trace, 7981

State

instance state, 9598

stateful API, 154155, 169

stateless API, 153156, 167169

Strict equality, 1718

Strict mode, 36, 51, 6970

String, 1516

String characters, replacing, 167169

String [[Class]], 108109

String literal, 3

String sets, 160163

Strings, 7576

Structural types, 161

Structural typing, 159

Subclass constructors, 101105

Superclass constructors, 101105

Superclass property names, 105106

Supplementary plane, 27

Surrogate pair, 2729

Synchronous function, 172

T

takeWhile, 135137

Target object, 151153

Termination, 133134

Text formatting, 156, 159

that, 100

then, 197199

32-bit integers, 7, 10

this, 5859, 66, 98100, 169

Threads, 172

throw, 2425

toHTML, 157159

Tokens, 2022, 25

toString, 78, 1214, 1718, 7778, 8486, 9295, 153, 167

trimSections, 4243

true, 146

Truthiness, 13, 147149

Truthy, 13, 135, 137, 147

try, 179, 182

tryNextURL, 183184

Type errors, 9, 12

TypeError, 90, 108

typeof, 7, 14, 165166

U

UCS-2, 2627

uint32, 166

Unary operator, 17

undefined, 11, 14, 144151, 169

Underscore character, 94

Unicode, 2529

use strict, 36

User class, 86

User.prototype, 8487, 9091, 93

UTF-8, 26

UTF-16, 2628

UTF-32, 26

V

val, 41

valueOf, 1214, 1618

var, 22, 3235, 4253

Variable hoisting, 4244

Variable-arity function, 6566, 68

Variable-length encoding, 27

Variadic function, 6566, 68

W

Web development practices, 144

when, 198

while loop, 130132, 188189

Width/height, 143144, 150

Wiki formatter, 157

Wiki library, 156160

with statement, 3539

Worker, 187188

Work-list, 131

Work-set, 127131

wrapElements, 4446

X

x and y, 38, 104, 150, 152

XMLHttpRequest library, 174175