Modern JavaScript for the Impatient Bug List


Section 3.9
Add ; n++ after the second sum += value
Section 5.2
x.toExponential(4) // '1.667e-3'
x.toExponential(4) // '1.6667e-3'
Section 7.10
Change map.forEach((key, value) => { to map.forEach((value, key) => {
Section 8.3
Change 123,456.78 to 123.456,78 (2x) and switch value: '.' and value: ','
Section 8.8
Change the last Note to:

The Intl.Locale class provides a way for denoting a locale with certain options:

const usMilitaryTime = new Intl.Locale('en-US', { hourCycle: 'h23' })

Supported options are: language, script, region, calendar, collation, hourCycle, caseFirst, numeric, numberingSystem.

Section 9.9
Change for (url of urls) to for (const url of urls) (2x)
Section 9.11
In the third code sample, remove Promise.all:
const [img1, img2] = [await loadImage(url), await loadCatImage()]
Section 10.6
In the exported anonymous class, change encrypt(key) and decrypt(key) to encrypt(str) and decrypt(str)
Section 11.10
Change “Every function that is an instance of the class Function” to “Every function that is defined with the function keyword”
Section 12.3
  for (line of lines(filename)) {
    if (line.contains(target)) { 
  for (const line of lines(filename)) {
    if (line.includes(target)) { 
Section 13.12.2
In the last two code snippets, move the => to the preceding line:
                    . . .: string }) =>
    leftDelimiter + . . .
Section 13.13.1
Change constructor(key: K, second: V) to constructor(key: K, value: V)
Section 13.13.3
let greeting = 'Hello'
let greeting: String = 'Hello'

Thanks to (your name might go here) for their bug reports!

Bug Report Form

If you have found another bug in the book or in our code that is not mentioned in this bug list, then please send a report. Unfortunately, I cannot reply personally to each report, but I do read all your comments.

Your name:

Your email address:

Page number:

Problem description:

To protect against spam robots, please answer this simple math problem:
* =