Errata
Eloquent JavaScript, 3rd Edition

These are the known mistakes in the third edition of the book. For errata in the first edition, see this page. For the second edition, see this page. To report a problem that is not listed here, send me an email.

Issues whose page number is followed by an ordinal number are only present up to the print denoted by that number. I.e. those followed by “1st” were fixed in the second print.

Chapter 2

Page 34 (1st) Updating Bindings Succintly: Where it says counter- it should be counter--.

Chapter 5

Page 91 (3rd) Composability: Due to an initial mistake in the script data set, the results of the computations on this page differ from the ones with the current, corrected data. The average year for living scripts should be 1165, the average for non-living scripts should be 204.

Chapter 6

Page 111 (2nd) Inheritance: In the second paragraph below the example code, instead of “content method”, the text should say “element function”.

Chapter 8

Page 134 (2nd) Error Propagation: In the third paragraph of the section, a function promptInteger is referred to. The function is actually called promptNumber, and the word “whole” should be dropped from the sentence (it accepts non-whole numbers, too).

Chapter 10

Page 168 (1st) Modules as Building Blocks: In “each needs it own private scope“, it should say “its own private scope“.

Chapter 11

Page 189/190 (4th) Networks are Hard: The text under the code that defines request claims the function will give up after four attempts and a second. In fact, it gives up after three attempts, in three-quarter second.

Chapter 14

Page 231 (5th) Moving Through the Tree: Below the code example, the text claims that for/of loops don't work on DOM child lists. But in current (even as of the book's release) browsers they do.

Page 234 (2nd) Creating Nodes: In the code, “edition” is misspelled as “editon”.

Chapter 15

Page 255 (7th) Mouse Motion: The second paragraph on the page claims that you can isolate a button from the buttons bitmask with the remainder operator, but that doesn't really work (you'd also need a division and a floor, which gets too obscure to go into in this chapter).

Page 258 (3rd) Load Event: The description of the beforeunload claims that you just need to return a string from your event handler. For handlers registered with addEventListener you, in fact, need to call preventDefault and set a returnValue property to get the warn-on-leave behavior.

Chapter 16

Page 271 (8th) Actors: Near the bottom of the page, the book incorrectly uses the term phase (of a sinus wave) where it should say period.

Page 278 (8th) Motion and Collision: The code that defines the touches method unintentionally (though harmlessly) used var instead of let to define variables.

Page 285 (2nd) Pausing the Game: The text refers to the arrow binding, where it should say arrowKeys.

Chapter 19

Page 336 (5th) The State: The text mentions the property fillColor where it should say fillStyle instead.

Chapter 20

Page 367 (10th) A File Server: The part that talks about “the output stream to the request” should say “the stream from the request” instead.

Page 369 (1st) Directory Creation: MKCOL stands for “make collection”, not “make column” as the book claims.

Chapter 21

Page 373 (3rd) HTTP Interface: There is a superfluous closing brace at the end of the example JSON snippet.

Exercise Hints

Page 414 (3rd) A Modular Robot: The dijkstrajs package name is misspelled as dijkstajs.