Errata

JavaScript: The Definitive Guide

Errata for JavaScript: The Definitive Guide, Seventh Edition

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Other Digital Version
Errata
Page 191 3rd para, 1st sentence

Meta-erratum: On the errata page, "rather that" should be "rather than" in this correction:

"Functions defined as expressions (rather that with a declaration) are not hoisted…"

Mike Morrison  Apr 16, 2021 
Printed
Page xiv
Near top

After "Constant width bold", the following line has no period at the end, unlike the similar explanatory lines that precede it on the same and previous page:

"Shows commands or other text that should be typed literally by the user"

Suggested fix: Add period.

Mike Morrison  Apr 18, 2021 
---
section 6.2.3, 6.3.2, chapter 9

I had a pretty hard time understanding inheritance in Javascript, and I think the central problem was that prototypes are not associated with objects just via property access (i.e. o.prototype), but in some internal manner that is only accessible via Object.getPrototypeOf(o) or (apparently non-standardized but de facto available in most JS environments) via o.__proto__. This seems to me like a crucial piece of information that should be mentioned early on, i.e. that the prototype assigned to an object is not the same as its property o.prototype, that changing that property of the object does not change its prototype, and that there are significant internals that represent the prototype chain that aren't very visible and keep the chain from being changed by simple property assignment. I haven't gotten to chapter 14 yet, but a cursory glance at 14.3 tells me that those issues are probably being discussed there; if that's the case, then a forward reference at each of the relevant places with a short clarification that o.prototype is NOT the prototype assigned to an object and that there's some other mechanism to handle that association would have helped at least me quite a lot.

There are also two TODOs left in the book, and a good number of editorial errors (mostly small grammatical errors); it's possible those are a matter of the book not being quite finished yet.

Georg Bachmeier  Apr 25, 2020  May 13, 2020
Page 3.2.3
3.2.3 Arithmetic in JavaScript - 3rd code listing

"Number.EPSILON // => 2**-52: smallest difference between numbers"

Number.EPSILON is described as the "smallest difference between numbers" but in fact, it is the difference between 1 and the smallest value greater than 1 that is representable as a Number value.

There are smaller differences between numbers for example in the range from 0 to 1

Note from the Author or Editor:
Thanks for this clarification. That makes a lot more sense than what I wrote.

Please change:

// => 2**-52: smallest difference between numbers

To:

// Difference between 1.0 and the next-larger Number

Paweł Gawlas  Jul 27, 2021 
10.2.1
Node exports

I think 'exports' is not a constant, since you can overwrite it.

exports = "dog";

console.log(exports);

It originally seems to be a non-constant reference to 'module.exports';

'module.exports' is what you are interested in, so don't break the reference.

Jukka Pietarinen  May 02, 2020  May 13, 2020
Printed
Page 27
1 line of 3.2.3

Error in the errata
The errata for page 37 mentions that section 3.2.3 is on page 37 but it's on page 27.

Note from the Author or Editor:
(how meta!)

michel thibert  Sep 23, 2020 
Printed
Page 31
4th line of page

In the 4th line, the final "y" in the word "they" is missing. The line begins with:

default, the are in base 10, but you can use the .....

And it should say:

default, they are in base 10, ...

Oscar Fernandez Sierra  Sep 17, 2020 
Printed
Page 34
Sixth line of the last paragraph (before table 3-1)

The line says:

Unicode character specified by four hexadecimal digits or one to five digits when the

The right value is "six", not "five", as you can check in the last line of table 3-1: the highest codepoint is 10FFFF, that needs six digits. So it should say:

... one to SIX digits ...

Note from the Author or Editor:
Change "one to five digits" to "one to six digits"

Oscar Fernandez Sierra  Sep 17, 2020 
Printed
Page 37
First line of 3.2.3 Arithmetic in Javascript

The line says:

JavaScript programs word with numbers using the arithmetic operators . that the language provides.

The "." between "operators" and "that" should be removed.

Note from the Author or Editor:
Please remove the stray period in the first line of section 3.2.3 "Arithmetic in JavaScript"

Oscar Fernandez Sierra  Sep 17, 2020 
Printed
Page 41
7th line from bottom of page

The line reads:
... and iterable objects (chapter 12), it needed to define standard method that classes ....


The article 'a' is missing before 'standard'.

Note from the Author or Editor:
Please change "it needed to define standard method" to read "it needed to define a standard method"

Frans Jaspers  Oct 12, 2020 
Printed
Page 43
Section 3.8, 1st paragraph

"There is a fundamental difference in JavaScript between primitive values (undefined, null, booleans, numbers, and strings) and objects..."

The list of primitive values looks like it's intended to be exhaustive in which case symbol values are missing.

Note from the Author or Editor:
Please change "numbers, and strings)" to "numbers, strings, and symbols)"

Brian Chhun  Apr 19, 2021 
Printed
Page 47
3rd paragraph, 1st sentence

Maybe "constructor" should be "constructors" (plural) in this sentence:

"As an aside, note that the Boolean(), Number(), and String() functions can also be invoked—with new—as constructor.

Note from the Author or Editor:
Change "as constructor" to "as constructors"

Mike Morrison  Apr 20, 2021 
Page 51
Final code example

The code example displays a different output than what I experience when running this example under Chrome.

Original code follows:
let d = new Date(2010, 0, 1);
d.valueOf();

The book suggests the output of valueOf should be: 1262332800000
The output I obtained was: 1262264400000

I am unsure if this is due to a localisation issue of some type?

Note from the Author or Editor:
This is a timezone issue. The Date() constructor creates a date in local time, and you and I are in different timezones. Sorry for the confusion.

Please change:

// => 1262332800000

To:

// => 1262332800000; (timezone-dependent)

Michael Hiatt  Jun 16, 2021 
Printed
Page 57
Sidebar - 1st paragraph

"It will be a global now deeply nested..." --> "It will be a global how deeply nested..."

now --> how

Note from the Author or Editor:
In the "Using Undeclared Variables" sidebar please change "no matter now deeply" to "no matter how deeply"

Prabath Siriwardena  Sep 14, 2020 
PDF
Page 75
2nd para.

"The JavaScript number format allows you to exactly represent all
integers between −9,007,199,254,740,992 (−2^53 ) and
9,007,199,254,740,992 (2^53 ), inclusive. If you use integer values larger
than this, you may lose precision in the trailing digits."


Of course this should be:

−9,007,199,254,740,991 (−2^53-1 ) and 9,007,199,254,740,991(2^53-1)

as made clear by the words 'inclusive' i.e. closed interval.and 'larger'.

Error confirmed on pg. 81 by correct values of Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER
and isSafeInteger definition.

Note from the Author or Editor:
This change to the numbers should be applied on page 25 of the printed book, not on page 75

Anonymous  Apr 10, 2021 
Printed
Page 78
3rd paragraph, last sentence

The word "and" seems superfluous in this sentence:

7 >> 1 evaluates to 3, for example, but note that and -7 >> 1 evaluates to -4.

Note from the Author or Editor:
Change "but not that and" to "but note that"

Mike Morrison  Apr 21, 2021 
Printed
Page 89
4.12.1, 1st paragraph, last sentence

"propogates" should be "propagates"

Mike Morrison  Apr 21, 2021 
Printed
Page 95
first sentence of 4.13.7

The text has the word "comma" in monospace code font here:

"The comma operator is a binary operator..."

I wonder if the word "comma" should instead be set in normal text font, or maybe replaced with a literal comma character (",") in code font, for consistency with the descriptions of the other operators and to avoid implying that the word "comma" itself is a reserved word.

Note from the Author or Editor:
Set "comma" in roman not code font.

Mike Morrison  Apr 21, 2021 
100
Second sentence

There is an error in the description of the Set Class in 11.1.1

"A set is a collection of values, like an array is. Unlike arrays, however, sets are not ordered or indexed"

Actually, a JavaScript Set object keeps insertion order.

Note from the Author or Editor:
The iteration order of sets is explained at the end of the section, but the reporter is correct here that it is misleading to call them "not ordered" at the start of the section.

On page 268, in the 2nd sentence of 11.1.1, please change "sets are not ordered or indexed" to "sets are not indexed"

Anonymous  Oct 20, 2020 
Printed
Page 108
Last sentence

"As with all loops, the body of a for/of loop follows the parentheses..."

do/while loops are an exception to the "all loops" part of this statement.

Note from the Author or Editor:
Change "As with all loops, the" to "The"

Mike Morrison  Apr 21, 2021 
Printed,
Page 113
1st paragraph

Where read:

"... The throw statement is a kind of interim return from a generator function. "

should be read:

"... The yield statement is a kind of interim return from a generator function. "

Note from the Author or Editor:
Thanks for pointing out this particularly dumb typo. You are correct that the sentence should read "The yield statement is a kind of interim return from a generator function". The very next sentence also begins "The throw statement" and that one is correct as it stands.

Alfred Myers  Aug 18, 2020 
Printed
Page 118
1st paragraph, 3rd sentence

"If the block...does not have an associated catch clause, the interpreter checks the next-highest enclosing block..."

I feel like "next-highest" should be "next higher", since the directional metaphor in this paragraph is of exceptions propagating upward to higher levels. "Next-highest" seems to indicate stepping downward from the highest level.

Note from the Author or Editor:
Please delete "next-highest". The sentence is clear without it.

Mike Morrison  Apr 21, 2021 
Printed
Page 123
Last bullet point

"In strict mode, it is a syntax error for an object literal to define two or more properties by the same name."

Is this still the case? MDN seems to say the behavior has been changed:

"In ECMAScript 5 strict mode code, duplicate property names were considered a SyntaxError. With the introduction of computed property names making duplication possible at runtime, ECMAScript 2015 has removed this restriction."

'use strict';
var o = { p: 1, p: 2 }; // syntax error prior to ECMAScript 2015

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#duplicate_property_names

and

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode

Note from the Author or Editor:
In the last bullet of page 123, change "In strict mode" to "In ES5 strict mode" and at the end of the sentence change "(In non-strict mode, no error occurs)" to "(In non-strict mode, and in ES6 strict mode, no error occurs)"

Mike Morrison  Apr 21, 2021 
Printed
Page 124
2nd bullet point

The first sentence refers to an octal literal with a '0' not followed by an 'x' but this in fact describes a hexadecimal literal. Instead, it should read:

"beginning with a 0 that is not followed by an o".

Note from the Author or Editor:
Thanks for pointing this out. That text dates to the days before JavaScript explicitly supported the '0o' notation.

Please change the parenthetical text "(beginning with a 0 that is not followed by an x)" to "(integers beginning with a 0 that is not followed by a b, o, or x)"

James Maher  Sep 10, 2020 
Printed
Page 126
5.7.4, 1st paragraph, 3rd sentence

Maybe add "a", changing:
(such as function or class)
to:
(such as a function or class)

Note from the Author or Editor:
change "such as function" to "such as a function"

Mike Morrison  Apr 22, 2021 
Printed
Page 138
3rd bullet point, 2nd sentence

Maybe remove "and" from this sentence:

"Since p does not already exist in o, and if there is no setter method to call, then p must be added to o."

Note from the Author or Editor:
Change "and if there is no setter method" to "and since there is no setter method"

Mike Morrison  Apr 23, 2021 
Printed
Page 155
end of 1st paragraph

"For sparse arrays, length is larger than the highest index of any element."

This sentence seems to imply a difference with nonsparse arrays, however it is true of both.

Note from the Author or Editor:
Please change the final sentence of that paragraph so that it reads:

For sparse arrays, length is larger than the highest index of any element (but it does not tell us anything about the number of elements).

James Batman  Oct 19, 2020 
Printed, PDF
Page 158
Section 7.1.5., first para

Original: Array.from is another array factory method introduced in ES6.

Issue: Missing parantheses after Array.from()?

Possible fix: Add parentheses. ;)

Note from the Author or Editor:
Please add parentheses, changing "Array.from" to "Array.from()"

Jørgen Lang  Sep 18, 2020 
Printed, PDF
Page 166
2nd para, 1st sentence

Original: "Each of these functions…"

Issue: talking about iterator *methods*

Suggested fix: Change 'functions' to 'methods' for clarity.

Note from the Author or Editor:
At the start of the last paragraph of section 7.8.1 change "Each of these functions" to "Each of these methods".

Jørgen Lang  Sep 18, 2020 
Printed, PDF
Page 167
1st para

Original: "The function you pass to it should be predicate: a func‐ tion that returns true or false. "

Issue: In the section about find() and findIndex() it is said "...your predicate function returns a truthy value...". Both statements seem to mildly contradict each other. Boolean true/false is stricter than truthy/falsy.

Question: Which one should it be?

Note from the Author or Editor:
Thanks for pointing this out. You're correct that I've been inconsistent in my description of the return values of predicate functions on page 167 in the sections on "filter()", "find() and findIndex()" and "every() and some()".

I think the best way to fix this throughout without getting too tedious is to change the second sentence of the first paragraph of the "filter()" section so that it reads:

"The function you pass to it should be a _predicate_: a function whose return value will be interpreted as a truthy or falsy value."

Please set the word "predicate" in italics since this is the first time it is used and this is a definition.

Jørgen Lang  Sep 18, 2020 
Printed
Page 168
Third line of second paragraph (not counting the block of Javascript code)

In the third line of second paragraph, instead of showing "true" in monospaced font, appears <code>true></code>. That line says:

<code>true></code> and only interates through the entire array if your predicate always

instead of

true and only interates through the entire array if your predicate always

Note from the Author or Editor:
Please change <code>true</code> to "true" in code font.

Looks like maybe the manual process of fixing bad line breaks went awry here?

Oscar Fernandez Sierra  Nov 10, 2020 
Printed
Page 168
Block of code after first paragraph

In the second line of the first block of code, after the first paragraph, there is a line o f code that says:

a.some(x => x%2===0)

To use a good formatting style and to have a homogeneus style with a similar example (with the same predicate function) in the previos page, it should appear with a space before and after operators "%" and "===":

a.some(x => x % 2 === 0)

Note from the Author or Editor:
Please add the spaces that the reporter describes.
And then on the next line, add some spaces before the comment so that the comments are aligned.

Oscar Fernandez Sierra  Nov 10, 2020 
Printed
Page 168
2nd paragraph, last sentence

"Note also that, by mathematical convention, every() returns true and some returns false when invoked on an empty array."

Maybe add parentheses, changing "some" to "some()" in this sentence, for consistency with the other mentions of every() and some() in this section.

Note from the Author or Editor:
Change "some" to "some()" and ensure that it remains in code font.

Mike Morrison  Apr 23, 2021 
Printed, PDF
Page 177
last para, 1st bullet point

Original: "The length property is automatically updated as new elements are added to the list"

Question: 'list' or 'array'?

Note from the Author or Editor:
Please change the first bullet of section 7.9 "Array-like Objects" to end the sentence after "added", deleting "to the list."

Jørgen Lang  Sep 18, 2020 
Printed, PDF
Page 184
3rd para, 1st sentence

Original: "A name is allowed for functions, like the factorial function,"

Issue: Section refers to function expressions

Question: Did you mean, "A name is allowed for function expressions, like the factorial function,"?

Note from the Author or Editor:
Please clarify this text by changing:

"A name is allowed for functions, like the factorial function, that"

to:

"A name is allowed for function expressions, like the factorial function above, that"

Jørgen Lang  Oct 02, 2020 
Printed
Page 184
Last paragraph, 3rd sentence

"expression that defines" should be "expressions that define" in this sentence:

"This is not true for functions defined as expressions, however: these functions do not exist until the expression that defines them are actually evaluated."

Mike Morrison  Apr 23, 2021 
Printed, PDF
Page 186
2nd para, 1st sentence

Original: "…they inherit the value of the this keyword from the environment in which they are defined…"

Question: Are "environment" and "scope" used as synonyms?

Note from the Author or Editor:
I wasn't intending to use "environment" in any kind of technical sense. Scope would be a better word here.

Let's change "from the environment in which they are defined" to "from the scope in which they are defined"

Jørgen Lang  Sep 22, 2020 
Printed, PDF
Page 191
multiple

Original:

1st para, 1st sentence: "Inside the nested function f(), the this keyword is not equal to the object o. "

3rd para, 1st sentence: "…so in order to make this code work, the function definition for f will need to…"

Issue: Apparently inconsistent use of parentheses on function names. This happens on a few (but not many) occasions in the book.

Suggested fix: Add parentheses to function names where missing: f().

Note from the Author or Editor:
These paragraphs at the end of 8.2.2 discuss an object o, a method m and a function f. It is clearer if we just use single letters for f and m, so let's remove the parentheses in "Inside the nested function f()" and just write "Inside the nested function f"

Jørgen Lang  Sep 22, 2020 
Printed, PDF
Page 191
3rd para, 1st sentence

Original: "Functions defined as expressions instead of statements are not hoisted…"

Question: Shouldn't this be "declarations" instead of "statements"?

Note from the Author or Editor:
Yes, please change:

"Functions defined as expressions instead of statements are not hoisted…"

To:

"Functions defined as expressions (rather that with a declaration) are not hoisted…"

Jørgen Lang  Nov 21, 2020 
Page 195
Code example at the bottom of page 195

The max() function includes one parameter which is the parameter x. This example also works without any parameters as we are iterating through the arguments array-like object.

My question is, is there a reason that the parameter x has been included in the code example?

Note from the Author or Editor:
I don't actually remember why I defined the x parameter there. Perhaps to indicate that at least one argument is expected. You're right to ask about this, though. This seems more confusing than useful.

Please change "function max(x) {" at the bottom of page 195 to "function max() {"

Emrah Abdurahman  Dec 17, 2021 
Printed, PDF
Page 196
ch8, 4th para, last sentence

Original: "Rest parameters and the spread operator are often useful together, as in the following function, which takes a function argument and returns an instrumented version of the function for testing:"

Issue: This is the only time the term "instrumented" is used in the book. Term has not been introduced.

Quesion: Does it make sense to give a short description of the concept of instrumentation?

Note from the Author or Editor:
That is a good point. The concept of instrumentation is illustrated by the code, so let's not define it here. Instead just replace "instrumented" with "wrapped", which is the term I used in the code comments, anyway.

Jørgen Lang  Oct 05, 2020 
Printed, PDF
Page 196
8.3.4, 3rd para, last sentence

Original: "Rest parameters and the spread operator are often useful together, as in the following function, which takes a function argument and returns an instrumented version of the function for testing:"

Question: What is meant by "instrumented". The term is only used in this location in the book.

Note from the Author or Editor:
I'm using the word "instrumented" here to mean "modified to log timing information".
It is a nice, specific word. But the paragraph might be clearer if we change "...returns an instrumented version of the function for testing:" to "...returns a new function that wraps the original and adds a log message to report how long the original took to execute:"

Jørgen Lang  Nov 21, 2020 
Printed
Page 200
1st code comment line

Add "of", changing:

// Return the sum of the elements an iterable object a.

to:

// Return the sum of the elements of an iterable object a.

Mike Morrison  Apr 24, 2021 
Printed
Page 204
Last paragraph of 8.5 Functions as Namespaces

Appears "namesapce" instead of "namespace"

Oscar Fernandez Sierra  Jun 17, 2020 
Printed, PDF
Page 217
2nd para, 2nd sentence + 3rd para, 1st sentence

Original: "Here, for example, is a way to define the preceding not() function just shown using composition and partial application:" and

"We can also use composition and partial application to redo our mean and standard deviation calculations in extreme functional style:"

Issue: The term "composition" has not yet been introduced.

Suggestion: Add a short definition for the term "composition" as used in the book might be helpful although it is not absolutely necessary for the intended audience.

Note from the Author or Editor:
Change the sentence:

Here, for example, is a way to define the preceding not() function just shown using composition and partial application:

to:

Here, for example, is a way to define the not() function from the previous section using composition (i.e. the compose() function from the previous section) and partial application:

Jørgen Lang  Sep 22, 2020 
Printed
Page 218
Code in middle of page, first comment line, last word

"Euclidian" => "Euclidean"

Mike Morrison  Apr 24, 2021 
Printed, PDF
Page 226
2nd para, 1st sentence

Original: Finally, also note the things that do not change between Examples 9-1 and 9-2 : the range methods are defined and invoked in the same way for both classes.

Issue: missing formatting and parentheses for "range".

Suggested fix: Format "range" as [cursive]range()[/cursive].

Note from the Author or Editor:
The word "range" is incorrect in this sentence but the suggested fix is incorrect.

Please change "the range methods are defined and invoked in the same way for both classes" to "the methods of both classes are defined and invoked in the same way"

Jørgen Lang  Sep 28, 2020 
Printed
Page 228
4th line of code

In the comment "F.prototype.constructor === F for any F", I found "for any F" confusing, since, if I understand correctly, the preceding examples illustrate functions where that equality isn't true, because the prototype property has been overwritten.

Note from the Author or Editor:
Please change "for any F" in the comment to "by default"

Mike Morrison  Apr 24, 2021 
Printed
Page 230
1st bullet point

Maybe add "the" or "a" between "name of" and "class"

Note from the Author or Editor:
Change "the name of class" to "the name of the class"

Mike Morrison  Apr 24, 2021 
Printed, PDF
Page 232
2nd code example, 2nd line, comment

Original: // TypeError: r.parse is not a function

Issue: Missing ! before "TypeError"

Note from the Author or Editor:
Please change the code comment from:

// TypeError: r.parse is not a function

to:

// !TypeError: r.parse is not a function

(this notation is explained in the box on page 7)

Jørgen Lang  Nov 21, 2020 
Printed, PDF
Page 239
1st para, 1st sentence

Original: "In ES6 and later, you can create a superclass simply by adding an extends clause…"

Issue: "extends" creates a subclass (not a superclass), as demonstrated in the following code example.

Suggested fix: replace "superclass" with "subclass"

Note from the Author or Editor:
This is an embarrassing one...
In the first line of 9.5.2, please change "superclass" to "subclass"

Jørgen Lang  Sep 28, 2020 
Printed, PDF
Page 239
2nd para, 2nd last sentence

Original: Not only are instance methods like pop() inherited, but static methods like Array.isArray are also inherited.

Issue: Missing parentheses after Array.isArray?

Suggested fix: Not only are instance methods like pop() inherited, but static methods like Array.isArray() are also inherited.

Jørgen Lang  Sep 28, 2020 
Printed
Page 242
9.5.3, 2nd paragraph, 1st sentence

"added to set" => "added to the set"

Mike Morrison  Apr 25, 2021 
Page 242
2nd sentence of code comment at the start of example 9-7

Second sentence of the code comments says the following:

"Call add() and remove() like you would for a Set,..."

Issue: I think the author intended to say delete() instead of remove()

Note from the Author or Editor:
Please change "Call add() and remove()" to "Call add() and delete()"

Emrah Abdurahman  Dec 27, 2021 
Printed, PDF
Page 243
code example, 1st comment

Original: "// The Set-like method has() returns true if the count is non-zero"

Issue: Code tests for '> 0;' so 'non-zero' could be misleading.

Suggested fix: "…returns true if the count is greater than zero"

Note from the Author or Editor:
Change:

// The Set-like method has() returns true if the count is non-zero

to:

// The Set-like method has() returns true if the count is greater than zero

Jørgen Lang  Sep 28, 2020 
Printed, PDF
Page 243
code example, 4th comment

Original: "…if the count goes back down to zero."

Issue: Comment mentions "zero", but code tests for count === 1.

Question: Shouldn't the code read "count === 0"?

Note from the Author or Editor:
The code is correct as it stands. The comment is a little confusing, though.

Please change the comment from:

// the key from the Map if the count goes back down to zero.

to:

// the key from the Map if the count would go back down to zero.

Jørgen Lang  Sep 28, 2020 
Printed, PDF
Page 245
1st code comment, 1st word

Original: "Range set is a concrete subclass of AbstractSet."

Issue: Subblass is actually called RangeSet

Suggested fix: Change "Range set" to "RangeSet".

Jørgen Lang  Sep 28, 2020 
Printed, PDF
Page 245
3rd code comment

Original: "If the other set is not also Enumerable, it isn't equal to this one"

Issue: Code tests for AbstractEnumerableSet: if (!(set instanceof AbstractEnumerableSet)), but comment says 'Enumerable'.

Suggested fix: Change comment to: ""If the other set is not also an AbstractEnumerableSet, it isn't equal to this one""

Note from the Author or Editor:
This comment is misleading as it stands. But using the full AbstractEnumerableSet classname would make it wrap on to a second line. So let's fix it by writing "enumerable" instead of "Enumerable" so that it is clear we're just using an adjective and not refering to a particular class name.

Jørgen Lang  Sep 28, 2020 
Printed
Page 248
3rd bullet point

maybe "hood, constructor" => "hood, the constructor"

Mike Morrison  Apr 25, 2021 
Printed
Page 253
Final line of the third paragraph

There is no space between module.exports and object. It reads:

"...or by replacing the module.exportsobject entirely."

whereas it should read instead:

"...or by replacing the module.exports object entirely."

Note from the Author or Editor:
Please insert the space. (This was a production error caused while fixing a bad line break)

James Maher  Oct 09, 2020 
Printed, PDF
Page 253
3rd para

Original: "…by setting properties of the Exports object or by replacing the module.exportsobject entirely."

Issues: (Caveat: I might be completely mistaken here, so please forgive me if I get this wrong. I not much of a Node person.)

1. According to the Node documentation the exports object is written in lowercase. Also it seems as if exports is a variable (not an object), serving as a shortcut/reference for module.exports.

2, Missing space between "module.exports" and "object".

https://nodejs.org/api/modules.html#modules_exports_shortcut

Note from the Author or Editor:
1) In the second to last line before 10.2.1, change "Exports" to "exports" and set "exports" in constant width font.

2) In the last line before 10.2.1, insert the missing space (the space was accidentally deleted during production in order to fix a bad line break)

Jørgen Lang  Oct 09, 2020 
Printed
Page 255
Last code comment line

"namspace" => "namespace"

Mike Morrison  Apr 25, 2021 
Page 257
Last paragraph of 10.3.1

The last sentence of the last paragraph of section 10.3.1 which is in parentheses has a slight grammatical error. The issue is with this part:

"a modules export will be the same on every run..."

Suggested change is:

"a module's export will be the same on every run"

I've added an apostrophe to "module's export" which indicates ownership.

Note from the Author or Editor:
In addition to adding the apostrophe, let's also make "exports" plural. Please change "a modules export" to "a module's exports"

Emrah Abdurahman  Jan 02, 2022 
Printed, PDF
Page 258
1st para, 5th sentence

Original: "A module specifier string must be an absolute path starting with “/”, or a relative path starting with “./” or “../”, or a complete URL a with protocol and hostname."

Issue: "…a complete URL a with protoco…". Unneccessary 'a' after 'URL'

Suggested fix: Remove 'a' and save it in case someone needs better grades. ;)

Note from the Author or Editor:
Please change "complete URL a with" to "complete URL with"

Jørgen Lang  Sep 30, 2020 
Printed, PDF
Page 258
3rd para, 3rd sentence

Original: "The exporting module can export any number of named value."

Suggested fix: Add plural 's': "The exporting module can export any number of named values."

Jørgen Lang  Sep 30, 2020 
Printed, PDF
Page 259
2nd last para, last sentence, just before section 10.3.3

Original: "…you can still import the module . just for that default behavior."

Issue: Period in the middle of a sentence.

Suggested fix: "…you can still import the module just for that default behavior."

Note from the Author or Editor:
Please remove the spurious period. (Git logs show it was accidentally inserted as part of the index creation process)

Jørgen Lang  Sep 30, 2020 
Page 261
3rd line of code on first code block

The third code line on the first code block incorrectly spells "stddev". This needs to be changed from "export { mean, stdev };" to "export { mean, stddev };"

Note from the Author or Editor:
Please change "export { mean, stdev };" to "export { mean, stddev };"

Emrah Abdurahman  Sep 12, 2021 
Printed
Page 264
10.3.6, 2nd paragraph, 2nd sentence

"transfered" => "transferred" (to match preceding sentence)

Mike Morrison  Apr 25, 2021 
Printed
Page 269
1st bullet point

"used chained" => "use chained"

Mike Morrison  Apr 25, 2021 
Printed
Page 271
11.1.2, sentence after first code block

hyphenate "two element" => "two-element"

Note from the Author or Editor:
Change "two element" to "two-element"

Also, in the third code comment below this paragraph please change "// Same as new map(" to "// Same as new Map("

Mike Morrison  Apr 25, 2021 
Printed, PDF
Page 272
line 7 of 1st code example

Original: // => undefined: this key is not in the set

Issue: It's a map.

Suggested fix: Change comment to "// => undefined: this key is not in the map"

Jørgen Lang  Oct 01, 2020 
Printed
Page 281
1st full paragraph

"DataView also defines 10 corresponding Set methods..."

Maybe "Set" should be lowercase and in code font to match "get" in the preceding paragraph.

Note from the Author or Editor:
Change "Set" to "set" and put it in code font.

Mike Morrison  Apr 26, 2021 
Printed
Page 283
First paragraph

The book states "A number of punctuation characters have special meanings in regular expressions."

Then states the list"^ $ . * and so on.

The list includes "="

"=" is not a special character in RegExp and as far as I know, doesn't need to be escaped. I couldn't find an example where it has to be escaped. If that's true, that character should be omitted from the list.

Note from the Author or Editor:
Please remove "=", "!" and ":" from the list of punctuation characters with special meanings near the top of page 283.

They are used in (?:...), (?=...) and (?!...), and although it might sometimes be necessary to escape the ? inside parentheses, it should never be necessary to escape the =, !, or : characters.

Camille Lambert  Oct 29, 2020 
Printed
Page 285
5th line

"grammar: it is" => "grammar: each is"

Note from the Author or Editor:
Change "it is the name of a category of characters defined" to "they are names of character categories defined"

Mike Morrison  Apr 26, 2021 
Printed, PDF
Page 289
3rd para (box) 2nd sentence

Original: In the preceding example, we were able to use a regular expression “backreference” to write a RegExp that would match a single- or double- quoted string where the open and close quotes had to match.

Issue: Example with quotes is previous page 288,

Suggested fix: "On the previous page, we were…" or simply "Earlier, we were…"

Note from the Author or Editor:
Please replace "In the preceding example" with "Earlier"

Jørgen Lang  Oct 06, 2020 
Printed
Page 298
Next to last paragraph, last line

"matching the any named" => "matching any named"

Mike Morrison  Apr 27, 2021 
Printed, PDF
Page 301
2nd para, 2nd setence

Original: If you want to specify a date and time in UTC (Universal Coordinated Time, aka GMT), then you can use the Date.UTC().

Issue: Missing word at end of sentence.

Suggested fix: …then you can use the Date.UTC() method.

Sauce: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/UTC

Note from the Author or Editor:
Please remove the word "the", so that "you can use the Date.UTC()" becomes "you can use Date.UTC()"

Jørgen Lang  Oct 15, 2020 
Printed
Page 306
11.6, first sentence

"must to convert" => "must convert", and "characters than can" => "characters that can"

Mike Morrison  Apr 27, 2021 
Printed
Page 310
2nd and 3rd list items

Maybe the property name 'style' should be in code font in both occurrences of:

'If style is "currency",'

Note from the Author or Editor:
Set the word "style" in code font in the two locations indicated.

Mike Morrison  Apr 27, 2021 
Printed, PDF
Page 314
1st para after code example, 1st sentence

Original: "Intl.DateTimeFormat can display dates using calendars other than the default Julian calendar based on the Christian era."

Question: Shouldn't this be "…Gregorian calendar…"?

Note from the Author or Editor:
Yes, please change Julian to Gregorian

Jørgen Lang  Oct 16, 2020 
Printed, PDF
Page 314
2nd code example, 2nd last line

Original:
Intl.DateTimeFormat("en-u-ca-chinese", opts).format(d) // => "36 78"

Trying this in node and Chrome dev console, I get:
'2019(ji-hai)'

Which version is correct?

Note from the Author or Editor:
I get "2019(ji-hai)" in Firefox as well, so whatever that old value was it was either wrong or no longer the default.

So please replace:
// => "36 78"
with:
// => "2019(ji-hai)"

To be honest, though, in the next edition I might just delete this entire line from the example. I'm trying to demonstrate calendar eras here and this one doesn't seem to have one.

Jørgen Lang  Oct 16, 2020 
Printed
Page 319
11.8.1, 3rd line

"as format" => "as a format"

Mike Morrison  Apr 27, 2021 
Printed
Page 328
Last line of last paragraph

It says

".. to iterate though a “partially used” iterator"

but it was probably intended to say

".. to iterate through a “partially used” iterator"

That is "though" => "through"

Note from the Author or Editor:
Change though to through on the last line of prose on page 328

Hugo Gabriel Eyherabide  Jan 30, 2021 
Printed
Page 333
Last line

Appears

]

instead of

]

The exact text is

bol.Iterator]()

Note from the Author or Editor:
Please replace the HTML entitty &rbrack; with a plain right bracket in code font: ']'
(This error does not appear in the QC2 draft, so it must have crept in during one of the very final production steps.)

Oscar Fernández Sierra  Jul 30, 2020 
Printed
Page 333
Next-to-last line

"method show in" => "method shown in"

Note from the Author or Editor:
Please change "show" to "shown" on the second to last line.

On the last line of the page, change "&rbrack;" to "]"

Mike Morrison  Apr 27, 2021 
Printed
Page 340
Bullet item

Text says:

"Generator functions can use the `yield` operator to specify thevalues that are returned by the iterator."

I wonder if it should say "`yield` statement"? 'yield' isn't an operator in the true sense, I believe?

Note from the Author or Editor:
The text should not say "statement". Yield really isn't a statement. But it is confusing to call it an operator here. Please change "the yield operator" to "the yield keyword"

Jens Olaf Koch  Oct 19, 2020 
Printed, PDF
Page 355
various locations throughout section 13.2.4

Problem: In various locations outside the section about Promise chaining method names are written as .method() with a prepended period.

Question: Should all instances of the prepended period be kept, even if they occur outside the context of chained promises?

Note from the Author or Editor:
To be honest, I don't remember why I started writing .then() and .catch() instead of just then() and catch(). I think you're right that it was probably to emphasize the nature of promise chains. But as you point out it seems to get out of hand starting on page 355. I will consider taking all these extraneous periods out in the next edition: it is not clear to me that they make anything clearer here.

Jørgen Lang  Oct 21, 2020 
Printed, PDF
Page 356
3rd full para, 2nd and 3rd sentence

Original: "If you add a .finally() invocation to your Promise chain, then the callback you pass to .finally() will be invoked when the Promise you called it on settles. Your callback will be invoked if the Promise fulfills or rejects, and it will not be passed any arguments, so you can’t find out whether it fulfilled or rejected."

Question: Is "Your callback" the same as the one that's invoked in the previous sentence?

Note from the Author or Editor:
Yes it is. But the wording is unclear. Please change:

"...will be invoked when the Promise you called it on settles. Your callback will be invoked if the Promise fulfills or rejects, and it will not be passed any arguments, so you can’t find out whether it fulfilled or rejected."

To:

"...will be invoked when the Promise you registered it with settles. That callback will be invoked if the Promise fulfills or rejects, and it will not be passed any arguments, so it cannot tell whether the Promise fulfilled or rejected."

Jørgen Lang  Dec 03, 2020 
Printed
Page 358
2nd paragraph, 1st line

"if the we get" => "if we get"

Mike Morrison  Apr 28, 2021 
Printed
Page 359
First paragrapth, 8th line

Last phrase of the first paragraph says:

A .catch() callback can throw a new error, but if it returns normally, **than** that return value is used to resolve and/or fulfill the associated Promise, and the error stops propagating.

Change to be made:

than => then

Note from the Author or Editor:
Please change "than" to "then"

Oscar Fernandez Sierra  Aug 08, 2020 
Printed, PDF
Page 362
2nd last paragraph

3rd sentence: "Promise.resolve() takes a value as its single argument and returns a Promise that will immediately (but asynchronously) be fulfilled to that value."

5th sentence: "(To be clear: the Promises returned by these static methods are not already fulfilled or rejected when they are returned…)"

These two sentences seem to directly contradict each other. In sentence #3 it is said that "a Promise will **immediately** […] be fulfilled" while sentence #5 appears to state the opposite: "the Promises returned by these static methods **are not already fulfilled** or rejected when they are returned"

I suppose that the text in the parentheses is meant to be more specific, given some more details about the process, but I'm not absolutely sure. What am I missing?

Note from the Author or Editor:
This is a confusing concept, and you're right that those two sentences do seem to contradict each other. I've tried to clarify in the long parenthetical, but maybe it is not clear enough.

Any event-based program, like JavaScript programs typically are consist of short bursts of synchronous code execution followed by waiting for events to occur so that they can be responded to. So "will immediately (but asynchronously) be fulfilled" basically means "this promise will be fulfilled as soon as the current chunk of code is done and we would otherwise go back to waiting for events."

Jørgen Lang  Nov 24, 2020 
Printed
Page 367
Last paragraph, 3rd line

It says:

"...are designed the way **the** are."

Change to be made:

the => they

resulting in

"...are designed the way **they** are."

Hugo Gabriel Eyherabide  Feb 06, 2021 
Printed
Page 373
First code block under Sec.13.4.4

The redefined clock() function has exactly the wrong behavior that the author purport to prevent: when multiple promises are created manually in close succession using the clock() function, all will finish awaiting at roughly the same time.

The problem arise because the increment of this.count happens after the await expression. As a result, all manually created promises share the same un-incremented value of this.count in the definition of targetTime.

It is not enough to move the increment to before the await expression: while the awaiting time is now corrected, all promises will return with the post-increment value of this.count.

The proper fix is to create a local variable that captures the value of this.count, and then increment this.count, all before awaiting. The result code may looks at follows (checked in Node v12.16.3)

// original code before definition of targetTime omitted
let count_val = this.count;
let targetTime = this.startTime + count_val * interval;
this.count++;
await until(targetTime);
return { value: count_val };
// original code following the return omitted

Note from the Author or Editor:
The reporter is absolutely right. I should have tested this more carefully.

Please replace the clock() function in 13.4.4 with the corrected code from https://github.com/davidflanagan/jstdg7/blob/master/ch13/clock2.js

Wing-Ho Ko  Jul 15, 2020 
Printed, PDF
Page 377
13.5, last bullet point

Original: You can create asynchronously iterable objects by implementing a [Symbol.asyncIterator]() method or by invoking an async function * generator function.

Question: Is there a particular reason to wrap "Symbol.asyncIterator()" in brackets here while it is written without brackets in the chapter itself?

Note from the Author or Editor:
I like the square brackets on page 377. And I do the same thing with [Symbol.iterator]() in the final bulleted list of chapter 12, so let's keep this as is.

However, on page 373, in the first paragraph of 13.4.4, "Symbol.asyncIterator()" should be "[Symbol.asyncIterator]()"

Jørgen Lang  Nov 24, 2020 
Printed
Page 381
Paragraph after first code example

There's an extra unbalanced parenthesis in middle of the parenthetical sentence:

"in §14.3); see also the"

should be:

"in §14.3; see also the"

Mike Morrison  Apr 30, 2021 
Printed, PDF
Page 386
section 14.3

Question: Is the varying formatting in section correct and consistent?

The sentence: "Remember also that when <code>prototype</code> appears in code font, it refers to an ordinary object property, not to the <code>prototype</code> attribute:" appears to contradict itself

Note from the Author or Editor:
Thanks for catching this. Whenever I say "the prototype attribute" in section 14.3 the word "prototype" should be in italics, not in code font.

It looks like this was introduced during copy-editing with commit e8b9a5d117316e3e814c6c56cbb78f98dfbcd48b. The easiest fix might be to revert that commit and then manually fix the two or three valid edits it included.

Jørgen Lang  Nov 25, 2020 
Printed, PDF
Page 391
3rd last paragraph, 2nd sentence

Original: Typed array classes use the Symbol in the same way that the Array class does.

Issue: not classy enough

Suggested fix: Add "class" after "Symbol".

Note from the Author or Editor:
The text is correct, but confusing as it is. I'm talking about this particular symbol under discussion Symbol.species. But because of the capitalization convention, it is not clear that I mean one particular symbol instead of the Symbol type. Adding "class" does not help. Let's fix this by naming the symbol explicitly.

Please change:

Typed array classes use the Symbol in the same way that the Array class does.

To:

Typed array classes use Symbol.species in the same way that the Array class does.

And set "Symbol.species" in code font as it is everywhere else in this section.

Jørgen Lang  Nov 25, 2020 
Printed
Page 405
14.7.1, 2nd sentence

Suggestion: Remove the word "if" from this phrase:

"we'll find that if we can query the proxy...and it will tell us that we should be able..."

Alternatively, the word "if" could remain, and the words "can" and "and" could both be removed instead.

Note from the Author or Editor:
Change "that if we can query" to "that we can query"

Mike Morrison  May 01, 2021 
Printed
Page 411
Last bullet point in box, 2nd sentence

The word "on" seems superfluous in:

"...work with XML documents on..."

Note from the Author or Editor:
Change "XML documents on" to "XML documents"

Mike Morrison  May 03, 2021 
Page 412
3rd paragraph

The first sentence of the 3rd paragraph seems to have a typo. Remove the "a" after the "the" so it says: "A <script" tag with the src attribute"

Note from the Author or Editor:
Please change "with the a src attribute" to "with a src attribute", deleting the extraneous "the"

Emrah Abdurahman  Oct 02, 2021 
Printed
Page 415
<p>-Tag in lower listing

I would suggest to add a closing </p> tag here (just to adhere to HTML best practice).

Note from the Author or Editor:
In the example on page 415, add a closing '</p>' tag after "This is a <i>simple</i> document."

Jens Olaf Koch  Oct 20, 2020 
PDF
Page 436
First paragrph, the 7th line.

Original: "Capturing event handlers registered on the event target itself are not invoked."

Issue: The default behaviour in capture mode is that the event handler for the event target is indeed invoked after its parent and grandparent elements' event handlers are invoked. Unless the propagation is explicitly stopped in its parent element.

Suggestion: Remove not from the last sentence.

Note from the Author or Editor:
Delete the last sentence of the first paragraph of page 436. And also in the sentence before that, delete "of the parent"

Khaled Elnaggar  Apr 24, 2021 
Printed
Page 440
7th line of text

Add "on", changing:

"whether it is a click a hyperlink."

to:

"whether it is a click on a hyperlink."

Note from the Author or Editor:
Change "click a hyperlink" to "click on a hyperlink"

Mike Morrison  May 04, 2021 
Page 442
1st paragraph

Regarding parentNode at the top of page 442. It is described in the context of being on the Element class but after searching for it on MDN it seems as though it is only defined on the Node class and not on the Element class. As the Element class is a subclass of the Node class, the parentNode property is inherited.

I wanted to clarify if parentNode should be removed from page 442 as it is defined on page 443 as part of the Node class.

Note from the Author or Editor:
At the top of page 442, please change "parentNode" to "parentElement", and change "or a Document object" to "or null". ("null" should be set in constant width code font)

Emrah Abdurahman  Oct 06, 2021 
Printed
Page 453
15.4.2, 2nd paragraph, 2nd sentence

"correspond" should be "corresponds" in:

"The DOM defines a style property...that correspond to the style attribute."

Note from the Author or Editor:
Change "correspond" to "corresponds". It is the singular style property that corresponds, not the Element objects.

Mike Morrison  May 05, 2021 
Page 458
5th paragraph

Second sentence of the fifth paragraph.

Change the word "animate" to "animation" so it says "...triggers an animation".

Note from the Author or Editor:
Please change "triggers an animate" to "triggers an animation"

Emrah Abdurahman  Oct 09, 2021 
Printed
Page 459
1st full paragraph, 1st sentence

"listen form" => "listen for"

Mike Morrison  May 06, 2021 
Printed
Page 460
2nd paragraph, 3rd sentence

It seems like "it" should be "they" in:

"...the CSS overflow property allows elements...to contain more content than it can display."

Note from the Author or Editor:
Change "than it can display" to "than they can display"

Mike Morrison  May 06, 2021 
Page 461
First sentence of last paragraph

The first paragraph states images as being block elements when they are inline elements by default.

Note from the Author or Editor:
Please change "Block elements, such as images, paragraphs and <div> elements" to "Block elements, such as paragraphs and <div>s"

Emrah Abdurahman  Oct 09, 2021 
Printed
Page 466
3rd line of text

"to to" => "to"

Mike Morrison  May 06, 2021 
Printed
Page 466
1st full paragraph, 1st sentence

"that it is used" => "that is used"

Mike Morrison  May 06, 2021 
Page 473
2nd paragraph

"slotchanged" needs to be changed to "slotchange" to be accurate.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/slotchange_event

Note from the Author or Editor:
Please change:

listener for "slotchanged" events

to:

listener for "slotchange" events

Emrah Abdurahman  Oct 12, 2021 
Printed
Page 476
7th commented line on this page

I think "do" should be "don't" here:

// in the template and do have to parse the HTML again.

Note from the Author or Editor:
Please change "and do have to parse" to "and do not have to parse"

Mike Morrison  May 07, 2021 
Page 480
1st paragraph, last sentence

The last sentence states "The function uses setTimeout() to ensure that it runs once a minute:".

The code specifies a timeout of 10,000 milliseconds, so this function runs 6 times a minute.

Note from the Author or Editor:
Please change "runs once a minute" to "runs every 10 seconds".

Emrah Abdurahman  Oct 13, 2021 
Printed
Page 489
2nd paragraph, 2nd sentence

Maybe the 1st "size" is superfluous in:

"Instead, set the desired on-screen size CSS pixel size..."

Note from the Author or Editor:
Please change "on-screen size CSS pixel size" to "on-screen CSS pixel size"

Mike Morrison  May 08, 2021 
Page 509
2nd paragraph

The second paragraph lists some of the properties of the Location object, one of them being "path".

I believe the property name is "pathname" rather than just "path":

https://developer.mozilla.org/en-US/docs/Web/API/Location/pathname

Note from the Author or Editor:
Please change "Properties like protocol, hostname, port and path" to "Properties like protocol, hostname, port and pathname"

Emrah Abdurahman  Oct 18, 2021 
Page 510
4th code block example

"document.location.path" should be "document.location.pathname"

Note from the Author or Editor:
Please change "document.location.path" to "document.location.pathname"

Emrah Abdurahman  Oct 18, 2021 
Printed
Page 517
2nd block of comments after class definition (line 154 of code)

maybe "try get" => "try to get"

Note from the Author or Editor:
Change "we try get" to "we try to get"

Mike Morrison  May 09, 2021 
Printed
Page 525
3rd paragraph, 1st sentence

"is it" => "it is" in:

"With POST requests, is it..."

Mike Morrison  May 10, 2021 
Printed
Page 528
2nd paragraph

I think this paragraph (about the value "default") should be indented to match the indentation level of the next 4 paragraphs ("no-store", "reload", "no-cache", and "force-cache").

Mike Morrison  May 10, 2021 
Printed
Page 529
source code

Missing parentheses and semicolon in the example source code to complete the addEventListener() call

Printed

ticker.addEventListener("bid", (event) => {
displayNewBid(event.data);
}

Correct

ticker.addEventListener("bid", (event) => {
displayNewBid(event.data);
});

Note from the Author or Editor:
In the middle of page 529, on the line following "displayNewBid(event.data);", please change "}" to "});"

Karmegam Pulendhiran  Dec 20, 2020 
Page 537
4th paragraph

deleteItem() is the wrong name for the method. It is called removeItem() which is on Storage objects:

https://developer.mozilla.org/en-US/docs/Web/API/Storage/removeItem

Note from the Author or Editor:
Please change "and deleteItem() methods" to "and removeItem() methods"

Emrah Abdurahman  Oct 22, 2021 
Page 540
5th paragraph

On the 5th paragraph before the code for the getCookies() function, the function is named in its non-plural form "getCookie()".

Note from the Author or Editor:
Please change "defines a getCookie() function" to "defines a getCookies() function"

Emrah Abdurahman  Oct 22, 2021 
Printed
Page 545
Example 15-13

On top of the file the following statement seems to be missing:

export {lookupCity, lookupZipcodes};

*

Without that statement I got the following error message in the developer console (Firefox):

Uncaught ReferenceError: import not found: lookupZipcodes (for zipcodes.js line 21, I believe)

Note from the Author or Editor:
The code shown in the book is okay as it stands, since it is presented alone with no code using it. You're right, however, that the zipcodes.js file at https://github.com/davidflanagan/jstdg7/blob/master/ch15/zipcodes.js imports the code in this example as a module. I need to fix this in the github repo, and we might as well fix it in the book as well.

On page 547, please change "function lookupCity" to "export function lookupCity"

And change "function lookupZipcodes" to "export function lookupZipcodes"

Jens Olaf Koch  Dec 04, 2020 
Printed
Page 545
Italicized caption of Example 15-13

"A" => "An"

Mike Morrison  May 11, 2021 
Printed
Page 553
1st paragraph, 1st line

"global postMesage()" => "global postMessage()"

Mike Morrison  May 11, 2021 
Page 553
1st statement of 1st code block

This statement is missing the parentheses at the end when creating the new MessageChannel. It should be:

let channel = new MessageChannel();

Note from the Author or Editor:
It is a little known fact of JavaScript syntax, that it is actually legal to omit the parentheses when invoking a constructor with no arguments. So this code works just fine as it is written. I didn't intend it that way, but the fact that it is legal syntax explains why it go past my linter without being flagged as a syntax error!

But this should be fixed. Please change "new MesssageChannel;" to "new MessageChannel();"

Emrah Abdurahman  Oct 24, 2021 
Printed
Page 559
Block comment, 3rd paragraph (line 48 of code)

"recieved" => "received"

Mike Morrison  May 12, 2021 
Printed
Page 560
Block comment, 4th line (line 116 of code)

"changes" => "change" ("parts...change")

Mike Morrison  May 12, 2021 
Printed
Page 563
3rd commented line (line 239 of code)

"which we do" => "which we are"

(alternatively: no change to this line, and instead "we're" => "we get" in the preceding line)

Note from the Author or Editor:
Change this comment in the code:

// a second argument of false which we do when we get a popstate event

To:

// a second argument of false (when handling a popstate event, for example)

Mike Morrison  May 12, 2021 
Printed
Page 564
Last else block of this page (line 320 of code)

"logarithic" => "logarithmic"

Mike Morrison  May 12, 2021 
Printed
Page 569
4th line of text

"knowledge is is much" => "knowledge is much"

Mike Morrison  Apr 28, 2021 
Printed
Page 571
15.15.6, 2nd bullet point, 4th word

"visiblitychange" => "visibilitychange"

Mike Morrison  May 10, 2021 
Printed
Page 573
15.15.8, 3rd bullet point

"themselves" => "itself"

Mike Morrison  May 12, 2021 
Printed
Page 574
1st paragraph, last sentence

unbalanced quotation marks in:

(using an <input type="file> form element)

Note from the Author or Editor:
Change:

<input type="file>

To:

<input type="file">

Mike Morrison  Apr 28, 2021 
Printed
Page 575
1st sentence

"enables" => "enable" ("allow...and enable")

Mike Morrison  May 12, 2021 
Printed
Page 579
2nd to last paragraph

Actual text is "Node makes these available though the process.env object"

It should be "through" instead of "though"

Mark Sun  Dec 31, 2020 
Printed
Page 581
5th line

The next phrase contais a comma that mush be removed. In the form that appears in the printed version, the meaning of the phrase is just the opposite to the intended one:

... If you don no want unhandled rejections, to print error messages or terminate your program, register a global handler function:

....

==> remove the comma after "rejections"

Note from the Author or Editor:
The sentence should read:

If you do not want unhandled rejections to print error messages or terminate your program, register a global handler function:

Oscar Fernandez Sierra  Aug 03, 2020 
Printed, PDF
Page 598
1st para, 4th sentence

Original: "An attacker could write an HTTP client that initiates requests for large files (such as images) but never actually reads the body of the request."

Issue: Client actually does not read the response body.

Suggested fix: Replace 'request' with 'response'

Note from the Author or Editor:
Change "never actually reads the body of the request." to "never actually reads the body of the response."

Jørgen Lang  Nov 06, 2020 
Printed
Page 598
Last paragraph, 2nd sentence

"they becomes" => "they become"

Mike Morrison  May 13, 2021 
Page 602
2nd code block example

The comment for os.networkInterfaces() has a period after the word "network".

Note from the Author or Editor:
Please change "network. connections" to "network connections"

Emrah Abdurahman  Nov 06, 2021 
Printed
Page 606
1st code example, try block, last comment line

"they bytes" => "the bytes" or "they"

Note from the Author or Editor:
Change "that they bytes" to "that the bytes"

Mike Morrison  May 13, 2021 
Printed
Page 609
6th line starting from the bottom of the page, in a comment in the code

Appears:

Two flags are combined with the bitwise OR opeartor | . The flags mean that

Change to be done: opeartor => operator

Note from the Author or Editor:
Please change "opeartor" to "operator"

Oscar Fernandez Sierra  Aug 06, 2020 
Printed, PDF
Page 610
continued code example on top of page

Since there is only one "formatting" option for "type of error" I chose this one. This is not a severe problem, but probably a formatting error during production.

The indentation - esp. of the first two lines - appears to be a little exaggerated (21 chars in).

Suggested fix: Align with rest of code.

Note from the Author or Editor:
Those lines do look strange at the top of page 610, but they are correctly indented.
When space allows, I like to indent function arguments written on separate lines
so that they all start at the column following the open parenthesis, and that is what I've done here. It would look fine if the pagebreak wasn't right there.

I see now, however, that there is an error on the very first line of page 610: that first line should end with a backtick character and a comma instead of the double-quote character that it currently ends with. That is change:

`Important data ${new Date().toISOString()}"
To:

`Important data ${new Date().toISOString()}`,

Jørgen Lang  Nov 27, 2020 
Printed
Page 613
First block of comments at the bottom of the page

There is a missing comma between "string" and "then" in the first line of comments:

Convert the body object to a JSON string then HTTPS POST ...

should appear:

Convert the body object to a JSON string, then HTTPS POST ...

or

Convert the body object to a JSON string and then HTTPS POST ...

The original code block is:

/*
* Convert the body object to a JSON string then HTTPS POST it to the
* specified API endpoint on the specified host. When the response arrives,
* parse the response body as JSON and resolve the returned Promise with
* that parsed value.
*/

I suppose the best option is the first one, to maintain uniformity with a phrase that has the same structure and that appears 6 lines below:

// Return a Promise object immediately, then call resolve or reject

Note from the Author or Editor:
Honestly, my grasp of grammar rules for commas is shaky enough that I don' t know if it is actually an error to omit that comma. But I agree that it is clearer with a comma.

Oscar Fernandez Sierra  Aug 28, 2020 
Printed
Page 616
else block, 5th comment line

The first occurrence of "type" seems superfluous in:

// Now guess the type file's content type based on extension

Note from the Author or Editor:
Please change "the type file's content type" to "the file's content type"

Mike Morrison  May 13, 2021 
Printed
Page 619
Next-to-last invocation of output() (line 72 of code)

What is the purpose of the template literal syntax in this line?

output(`${punchline}`, false);

Would it work the same if it were the following?

output(punchline, false);

Note from the Author or Editor:
In the middle of page 619, change this line of code:

output(`${punchline}`, false)

To this simpler form:

output(punchline, false)

Mike Morrison  May 13, 2021 
Printed
Page 625
Bullet point, 1st sentence

Either "the" or "," seems superfluous in:

"the multiple cores, which"

Note from the Author or Editor:
Change "across the multiple cores" to "across multiple cores"

Mike Morrison  May 14, 2021 
Printed, PDF
Page 628 ff
Section 16.11.2

Question: Are the terms "main thread" and "parent thread" synonyms or is there a subtle difference, e.g. a possibility for "nested" threads that need a clear term for a "direct ancestor"?

Note from the Author or Editor:
That is a good question, and should maybe be clarified in the text or in a footnote.

The main thread is the one that starts when Node starts. All other threads are worker threads. If the main thread creates a worker thread A, and worker thread A creates another worker thread B, then the parent thread of A is the main thread, but the parent thread of B is A. Often, the parent thread of a worker will be them main thread, but this will not be the case when a worker thread is created by another worker thread.

Jørgen Lang  Nov 13, 2020 
Page 629
3rd bullet point. 5th sentence in parentheses

The word "with" is duplicated:

"...and we saw the same thing with with child processes..."

Note from the Author or Editor:
Please change "with with" to "with"

Emrah Abdurahman  Nov 11, 2021 
Printed
Page 630
7th line starting from the bottom of the page

Appears:

it cannot copy object like SSockets and Streams. It can handle MessagePort objects.

Change to be done:

SSockets => Sockets (remove one of the two "S" at the beginning of the word)

Note about lack of uniformity in those names: in this line, "Sockets" and "Streams" appear with initial "S" (uppercase). The line before that one makes reference to the last paragraph of 16.11.1, in page 628, where that words appear as:

... such as sockets and streams. ...

(with initial lowercase in both words). This line is the 3rd line of that paragraph.

Note from the Author or Editor:
Please change "SSockets and Streams" to "sockets and streams".

Oscar Fernandez Sierra  Aug 06, 2020 
Printed, PDF
Page 630
section 16.11.4, 1st sentence

Original: The postMessage() function uses the structured clone algorithm, and as we’ve noted, it cannot copy objects like SSockets and Streams.

Issue: SSockets

Suggestion: The postMessage() function uses the structured clone algorithm, and as we’ve noted, it cannot copy objects like Sockets and Streams.

Note from the Author or Editor:
Please change "SSockets" to "Sockets"

Jørgen Lang  Nov 13, 2020 
Printed
Page 632
16.11.5, 1st code example, 4th comment line

"with" seems superfluous in:

// Now create a worker thread, passing the shared array to it with

Note from the Author or Editor:
Please remove "with" at the end of that code comment

Mike Morrison  May 14, 2021 
Printed, PDF
Page 635
bullet list, 2nd entry

Original: "Prettier for formatting your JavaScript code in a standardized way."

Issue: "Unnecessary "for" after "Prettier".

Note from the Author or Editor:
Most of the bullets begin with a tool name and "Prettier" is the name of the tool, so if you already know that Prettier is the name of a tool, then the sentence reads naturally as it is.

But I see now that if you have never heard of Prettier, then this looks like a typo.

Let's change "Prettier for formatting" to "The Prettier tool for formatting"

Jørgen Lang  Nov 16, 2020 
Printed
Page 642
Last sentence before bird icon

maybe "best...than" => "better...than" or "best...rather than"

Note from the Author or Editor:
Change "user experience is best" to "user experience is better"

Mike Morrison  May 15, 2021 
Printed, PDF
Page 644
17.6. 1st paragraph, last sentence

Original: "Babel was created so that web developers could use the new language features of ES6 and later while still targeting web browsers that only supported ES5."

Issue: This sentence seems a little outdated. It might be helpful to point out that Babel also supports current developments in ES2020, etc.

Suggestion: "Babel was initially created so that web developers could use the new language features of ES6 and later while still targeting web browsers that only supported ES5. It is under constant development to also support current and future versions of the EcmaScript standard."

Note from the Author or Editor:
This is a good idea. Please add the following sentence after "...while still targeting web browsers that only supported ES5.":

Babel continues to evolve, and it is common for language feature that are nearing standardization to be supported by Babel before they are implemented natively in browsers.

Jørgen Lang  Nov 17, 2020 
Other Digital Version
644
Errata list

"feature" should be "features" in the sentence to be added: "Babel continues to evolve, and it is common for language feature..."

Mike Morrison  Apr 17, 2021 
Printed, PDF
Page 646
2nd complete code example after 2nd para, code comments

Issue: In some of ther comments for said code example, the comments mention a <div/>-Element containing a trailing slash.

That would imply a self-closing version of <div>. AFAIK <div> always uses a closing tag, e.g. <div>...</div>.

Suggestions: Remove the trailing slash or place it before the 'div' part to denote a closing tag.

Note from the Author or Editor:
Please change "// This is the first child of the <div/>" to:
"// This is the first child of the <div>"

And change "The second child of the <div/>." to:
"The second child of the <div>."

Jørgen Lang  Nov 17, 2020 
Printed
Page 654
Next-to-last sentence

"use use" => "use"

Mike Morrison  May 15, 2021 
Printed
Page 655
1st sentence

"name" => "names"

Mike Morrison  May 15, 2021 
Printed, PDF
Page 656
3rd para, 1st sentence

Original: "If a property is not marked as optional in an object type, then it is required, and Flow will report an error if an appropriate property is not present in the actual value."

Question: Did you mean to say, "... is not present in the actual *type*."?

Note from the Author or Editor:
"value" is correct, but unclear. Let's change "not present in the actual value" to "not present in an object that is assigned to a variable declared to be of that type".

Jørgen Lang  Nov 18, 2020 
Printed
Page 659
17.8.7, 3rd paragraph

maybe "types" => "type" in:

"the type of the keys and the types of the values"

Note from the Author or Editor:
Please change "the types of the values" to "the type of the values"

Mike Morrison  May 15, 2021 
Printed, PDF
Page 661
2nd last para

Original: "To express the type of a function with Flow, write the types of each parameter, separate them with commas, enclose them in parentheses, and then follow that with an arrow and type return type of the function."

Issue: The last part ("…and type return type of the function.") of the sentence is unclear.

Did you mean, "…and **the** return type…"?

Note from the Author or Editor:
Please change "type return type" to "the return type"

Jørgen Lang  Nov 19, 2020