Eloquent JavaScript

These are the known mistakes in the second edition of the book. For errata in the first edition, see this page.


Page 4: The sentence “You can probably imagine how how tedious…” duplicates the word how.

Chapter 9

Page 159 (The Date Type): The findDate function produces the wrong months. The second argument given to new Date should be Number(match[2]) - 1, subtracting one to compensate for the fact that months start at zero in this interface.

Chapter 10

Page 185 (Slow-Loading Modules): In the code snippet for define, the second use of the every method is incorrect. The call should be to myMode.onLoad.forEach instead.

Chapter 11

Page 192 (Parsing): The example Egg program has its parentheses distributed incorrectly. One closing parentheses from the second line should be moved to the end of the last line.

Chapter 13

Page 238 (Creating Nodes): In the example code that adds a footer, the double quotes should be around the emdash (—) character, not after it.

Chapter 14

Page 242 (Mouse Motion): The example uses event.which to detect mouse button release. This only works in Chrome and Safari. See the updated code and comment for a better way.

Chapter 16

Page 281 (Curves): The text refers to the bezierCurve method. This method is actually called bezierCurveTo (as in the example code).

Page 282 (Curves): Where it says the picture shows a line from the left of the circle to the left of the quarter circle, it should definitely say right in both instances.

Chapter 17

Page 312 (Summary): The code example uses the statusCode property. This does not exist, since the property is actually called status.

Chapter 18

Page 327 (Summary): “When the user has selected a field” should be “When the user has selected a file”.