Modern JavaScript for the Impatient Bug List


Section 2.10
In the last Caution, change for (const i of greeting) to for (const i in greeting)
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 5.4 Table 5-1
Change 0.001666 to 0.00166666 and '1.667e-3' to '1.6667e-3'
Section 5.9
Change “Note that the time zone (but not the weekday or month name) appears in the user’s locale.” to “Note that the user's time zone (but not the weekday or month name) appears in the user’s locale. For some time zones, the date is July 21.” Change
moonlanding.toLocaleDateString() // '20.7.1969' if the locale is German
moonlanding.toLocaleDateString('en-US') // '7/20/1969'
moonlanding.toLocaleDateString() // '20.7.1969' with German locale and time zone
moonlanding.toLocaleDateString('en-US') // '7/20/1969' or '7/21/1969', depending on the time zone
Section 6.5
Remove the following three lines:

including three backslashes. The second string has two characters:

Section 6.14
let minutes = '10:30 - 12:00'.match(/[0-9][0-9](?!:)/g) // ['10, 12']
let minutes = '10:30 - 12:00'.match(/[0-9][0-9](?!:)/g) // ['30, 00']
Section 7.10
Change map.forEach((key, value) => { to map.forEach((value, key) => {
Section 7.4 Table 7-1
Change firstIndex/lastIndex to indexOf/lastIndexOf
Section 7.13
const farr = Float32Array.of(1, 0.5, 0.25, 0.125, 0.0625, 0.03215, 0.015625) 
const farr = Float32Array.of(1, 0.5, 0.25, 0.125, 0.0625, 0.03125, 0.015625) 
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.1
Change Symbol.iterable to Symbol.iterator
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.12.3
Change “This assignment is sound because pf can surely accept” to “This assignment is sound because pc can surely accept”
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 Katsutaka Ishibashi, Eran Yarkon, Kunio Yoshikawa and (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 or section number:

Problem description:

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