Errata

Learning JavaScript

Errata for Learning JavaScript

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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

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

Version Location Description Submitted by Date submitted
Printed Page (
Final paragraph and code

The code doesn't work.

I have followed the instructions and my code matches character to character with what he has, and I can't get a canvas. Is there something missing? Do I need to refer back to another file? I don't know, because nothing in here tells me what to do, and I don't have a canvas showing up.

I've tried putting the canvas parameters in a bunch of different areas in my CSS file, and nothing is working. I have tried referring to the CSS document using the <scrip src="main.css"</script> and nothing happen.

This is ludicrous.

I followed your book's instructions, and there is so little to refer to that I have no idea what the hell I am doing wrong.

Give some ideas on what could be adjusted if it doesn't work, or get your books to be correct the first place. I cannot believe I have wasted my money on your book, and I can't use it past page 9 because of this crap.

Anonymous  Nov 03, 2019 
Other Digital Version Errata
"Page 119 the example discussed at the end of the section "Lexical Versus Dynamic Scoping""

Just what exactly are we supposed to do with this errata? What do we change? This is a problem with several of these entries, but this is the worst so far. The purpose of publishing the errata on a public Web page is, presumably, to allow people who have editions of the book that do not include the corrections to add them themselves. But when there's no indication of what correction was actually made, this is impossible.

Jim Syler  Feb 02, 2022 
Other Digital Version page 119, chapter 5
6th paragraph

In this section of code, I believe the variable was incorrectly assigned:

```
let x, y;
y = x = 3 * 5; // original statement
y = x = 15; // multiplication expression evaluated
y = 15; // first assignment evaluated; x now has value 15, y is still undefined
```

In the line above, it is explained that "y" is still undefined, but displays the variable "y" in the code with the assigned value instead of the variable "x"

Franklin Sousa  Aug 14, 2022 
1
Chap 1, (search for quoted text in comment)

Chap 1, (search for the quoted text below, I can't mention page number because this is the online version)

jQuery is mentioned for the first time in the book here, yet it assumes there is some code referencing it:

"""
Right after we link in jQuery, but before we link in our own main.js, add the following line:
"""

It sounds like there used be more code in the past that was simplified and yet this line references that missing item.

Erik Johnson  Mar 09, 2019 
PDF Page 6
3rd paragraph

"console.log('main.js loaded');" is colorized. Given the earlier discussion (p.3) of syntax highlighting, the reader is led to believe that this coloring is standard for good text editors. However, it's not. No editor I could find (including Notepad++) colorizes this code. Either match the coloring in the book (for all code) to what is standard in text editors, or insert a note that the coloring in the book is not necessarily what you should expect in a text editor.

Jim Syler  Aug 04, 2019 
PDF Page 9
Note link

On the note of the bottom there is a link which says "HTML & CSS Track"

The link to the codecademy site (https://www.codecademy.com/tracks/web) is not valid (you will get 404 page).


The proper one would be
https://www.codecademy.com/learn/paths/web-development

Enrique Santonja  Apr 24, 2019 
Printed Page 10
Middle of the page

I found a work around in creating a canvas, but following your instructions I can't create the circle which your code is supposed to be making. Not only that, I can't find anything on your errata to help me.

This is absolutely ridiculous. If you are not going to test your code, or write it helpfully, why do you bother?

I am new to coding, and I feel like these books are simply a cash grab for you, because I'm worse off than before because nothing works, and I spent money on your product.

I've followed the instructions perfectly, and I can't get a damn thing to work.

I will never buy another O'Reilly book again, and if people ask me about my experience with them, I will encourage them to find another way to learn since there seems to be no care at all for actually doing the work of teaching.

While I may be a beginner, I am not an idiot; I can follow directions just fine, and nothing I do works here.

Anonymous  Nov 03, 2019 
PDF Page 10
First Line of Code in the page

I put it as a Minor Technical mistake although it may be catalogued as a serious one because it may create frustration right from the beginning on people with limited programming experience.


It says:

<script src="https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.9.24/ ↩
paper-full.min.js"></script>

Which does not work if the line is copy and paste as such. The little arrow at the end (Carriage Return and Line Feed?) creates an error and the green circle is not drawn.

It may have gone into the pdf version when composing the book in a text editor.... (I do not know if this shows in the printed version)

It should read:

<script src="https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.9.24/paper-full.min.js"></script>

and now the circle is drawn.

Marcelo Prillo  May 23, 2020 
Printed Page 24
Top

With the following version of gulp:
$ gulp --version
CLI version: 2.2.0
Local version: 4.0.2
$

using the gulpfile.js from the book:
$ cat gulpfile.js
const gulp = require('gulp');
// Gulp dependencies go here

gulp.task('default', function() {
// Gulp tasks go here
});
$

Results in the following:
$ gulp
[13:01:52] Using gulpfile ~/Scripts/javascript/lj/gulpfile.js
[13:01:52] Starting 'default'...
[13:01:52] The following tasks did not complete: default
[13:01:52] Did you forget to signal async completion?
$

I was able to correct this by adding "async" before "function" on the "gulp.task" line as follows:
$ cat gulpfile.js
const gulp = require('gulp');
// Gulp dependencies go here

gulp.task('default', async function() {
// Gulp tasks go here
});
$

which then gives the expected output:
$ gulp
[13:02:19] Using gulpfile ~/Scripts/javascript/lj/gulpfile.js
[13:02:19] Starting 'default'...
[13:02:19] Finished 'default' after 2.69 ms
$

Paul Cushing  Jul 30, 2019 
PDF Page 25, 26
code segment

gulp.task('default', function() {
// Node source
gulp.src("es6/**/*.js")
.pipe(babel())
.pipe(gulp.dest("dist"));
// browser source
gulp.src("public/es6/**/*.js")
.pipe(babel())
.pipe(gulp.dest("public/dist"));
});
It threw the error "Plugin/Preset files are not allowed to export objects, only functions."

I added this to the code
gulp.task('default', function(done) {
// Node source
gulp.src("es6/**/*.js")
.pipe(babel())
.pipe(gulp.dest("dist"));
// browser source
gulp.src("public/es6/**/*.js")
.pipe(babel())
.pipe(gulp.dest("public/dist"));
done();
});
And it did work fine.
I think the code could be updated, and detail explanation of what was wrong can be given. Because, though I found a way around it, I don't fully understand what was wrong, and how the change to the code fixed it.

Anonymous  Mar 12, 2019 
Printed Page 42
1st paragraph

To determine to last element in the array the reader is asked to type...

arr[arr.length - 1];

...and to expect a result of 'c'.

As the array has been populated on page#41 with:

const arr = ['a', 'b', 'c'];

The commands on page#42 are out of sequence as...

arr[arr.length - 1];

...will not return 'c' until the subsequent command to overwrite the values of the index are issued.

Clive McFarland  Nov 14, 2018 
PDF, ePub Page 47
Last paragraph

There is a punctuation issue. The commas and the dot are into the words in quotes when they should be between them.

The paragraph says

"The game is simple: there’s a mat with six squares with symbols for “Crown,” “Anchor,” “Heart,” “Club,” “Spade,” and “Diamond.” ..."

When the appropriate text would be

"The game is simple: there’s a mat with six squares with symbols for “Crown”, “Anchor”, “Heart”, “Club”, “Spade”, and “Diamond”. ..."

Enrique Santonja  Apr 30, 2019 
Printed Page 47
Sam3 Classification

In his classification object for sam3, he uses the word "class" as an identifier as I understand it, but isn't 'class' a reserved word? This is the only reason I can currently see why my code is not working as it matches his character to character in my code editor.

I may very well be misunderstanding this, so any help in clarifying would be great.

Kyle Christian  Aug 25, 2019 
Printed Page 134
3rd paragraph

The paragraph should start as:

"indexOf and findIndex are great if you're looking for the index of an element"

instead of:

"find and findIndex are great if you're looking for the index of an element"

Jean-Henry Berevoescu  Sep 23, 2018 
Printed Page 137
Last paragraph

In sentence: "We'll use the Unicode code points..., and we'll use "A", "J", "Q", and "Q""
last "Q" should be "K"

Jean-Henry Berevoescu  Sep 24, 2018 
Printed Page 170
2nd paragraph

The sentence in the book starts, "To use this, we can use the typeof
operator..." Yet the code immediately below employs the instanceof operator.

Suggested correction:
"To use this function, we can employ the instanceof operator..."

Suspected errata in Learning JavaScript by Ethan Brown hardcopy print edition.
re: (c) 2016 revision history for the Third Edition: 2016-02-12: First Release
re: ISBN 978-1-491-91491-5

Roy Tobin  May 11, 2021 
PDF Page 183
function translate in the example

In the return statement in function translate there is an extra semicolon, which generates the following error:

return { x: p.x + offset[0], y: p.y + offset[1]; };
^

SyntaxError: Unexpected token ;...

In the output above, the caret indicating the error should be under the semicolon after 'offset[1]'.

Paul Cushing  Nov 06, 2019 
Printed Page 246
3rd paragraph

The enlightening attribution for Kleene star
(or Kleene closure) is misspelled "Klene."

re: (c) 2016 revision history for the Third Edition: 2016-02-12: First Release
re: ISBN 978-1-491-91491-5

Roy Tobin  Apr 23, 2021 
Printed Page 285
Table 20-2. "Core modules"

Table 20-2 does not list the module "console" which is used in the
code examples before and after the table, to wit "console.log()."
Please include in the table any modules employed by example code. Cheers.

Roy Tobin  Apr 30, 2021 
Other Digital Version 363
subsection "Drawing Graphics Primitives"

Text "Right after we link in jQuery, but before" should be replaced by just "Before" to avoid confusion as there is no jQuery involved at this point of the book. [seen in Kindle version]

Anonymous  Dec 07, 2019