Errata

Programming JavaScript Applications

Errata for Programming JavaScript Applications

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
PDF Page ix
line 3

The given product link http://shop.oreilly.com/product/0636920024231.do does not work.
Should probably be http://shop.oreilly.com/product/0636920033141.do

Tom Verhoeff  Jun 15, 2014 
chapter 3.3.2
Prototype Cloning

In chapter 3.3.2 (I guess), Prototype Cloning, I read the code:

switch1.isOn.isShared = true;

ok(!switch2.isShared,
'Methods are copied for each instance, not shared.'
);

IMHO, the correct, expected test is: ok(!switch2.*isOn*.isShared,
And the conclusion I reached when experimenting with node.js is the
contrary: *Methods are shared*.

Anonymous  Oct 13, 2014 
Other Digital Version Chapter 5, Server Side Concerns, Next steps

In the following line from the code sample, I believe the + should not be there.

port = +process.env.PORT || 5555;

Jim Argeropoulos  Mar 18, 2015 
PDF, ePub Page viii
First paragraph under "Who this book is not for"

"David Flanagan," the author of <i>JavaScript: The Definitive Guide</i>, is misspelled as "David Flannagan."

Jeffrey Barke  Aug 30, 2015 
Printed

QUnit 2.x (following good JS programming practice) no longer exposes its commands as globals. Therefore none of the QUnit examples in the book work as written. Maybe just a quick little post somewhere on how to modify the code to work with QUnit 2?

Dave Kaye  Sep 02, 2016 
Printed Page Page96
Half way down running Grunt

In Ch4 4 when running Grunt to automate the build, I am seeing:

c:\Node\guestlist>grunt
Warning: Task "lint browserify qunit" not found. Use --force to continue.

Aborted due to warnings.


I have double checked the code but cannot locate the issue? (If forced it also errors)

Leigh Mathieson  Jul 22, 2017 
PDF Page 3
In First-Class Functions section

in Chapter 1, I found a broken link. The Underscores.js library has a custom URL now rather than a Github Pages url.

The link points to: http://documentcloud.github.io/underscore/

Should point to: http://underscorejs.org/

Anonymous  Sep 21, 2016 
PDF Page 8
1st paragraph after numbered dot points

The following paragraph is confusing.

"It’s common to be confused about whether to use PUT or POST to change a resource. REST eases that confusion. PUT is used if the client is capable of generating its own safe IDs. Otherwise, a POST request is always made on a collection to create a new resource. In this case, the server generates the ID and returns it to the client."

It talks about how people get confused about using a PUT or POST to change to a resource/data. The following sentences then go on and discus POST for the creation of a resource/data. No examples were given about PUT or POST for the changing/updating a resource which was the problem the first sentence in the paragraph was discussing.

Darrenddd  Aug 01, 2015 
PDF Page 11
2nd+3rd paragraph

IMHO, the explanation why the savedCart.items is also altered is wrong. Not the items field in the cartProto prototype is overwritten, but cart.items is a reference to savedCard.items after the invocation of createCart.

Also, there is a typo in the 3rd paragraph: storedCart should be savedCart.

  Sep 24, 2014 
PDF Page 22
code block

There's an unnecessary line because the same object is assigned.

-----
var lightbulb = {
...
lightswitch = document.getElementById('lightswitch');

lightswitch = document.getElementById('lightswitch'); // This line.
lightswitch.addEventListener('click',
...
-----

iwanaga  Jul 13, 2014 
PDF Page 22
1st code snippet

The line

lightswitch = document.getElementById('lightswitch');

was doubled in the code snippet and should only appear once.

  Sep 24, 2014 
PDF Page 22
code snippet

......
toggle = lightbulb.toggle,
lightswitch = document.getElementById('lightswitch');
lightswitch.addEventListener('click', lightbulb.toggle, false); // the listener function/handler, i.e. "lightbulb.toggle", should be replaced with "toggle" only - which is already assigned as a reference to "lightbulb.toggle", in order to demonstrate the use of "bind()" to work properly.


fixed code snippets:
.....
toggle = lightbulb.toggle.bind(lightbulb),
lightswitch = document.getElementById('lightswitch');
lightswitch.addEventListener('click', toggle, false);

Anonymous  Mar 16, 2015 
Printed Page 22
15th line (code in second paragraph)

We say that we can fix the fact that the event listener gets called with a different context by using bind. The example given is of binding "lightbulb" to the toggle function which is declared in the global scope but the actual function assigned to the click handler is the member function lightbulb.toggle (the member function) instead of the global "toggle" function to which we have bound the lightbulb object.

Fix would be to pass simply "toggle" to the add listener event.

Ken Marsh  May 20, 2018 
Printed Page 22
5th and 6th lines

Duplicated line:

lightswitch = document.getElementById('lightswitch');

Is repeated.

Ken Marsh  May 20, 2018 
Printed Page 26
top code snippet

Code snippet should read:

```
try {
ok(obj.data, ...
...
```

In order to reflect that you can not directly access the data through the object itself

Anonymous  Dec 28, 2016 
PDF Page 28
United States

In the example code under "Named Parameters" from Ch.2, line 14:
"name: email || userProto.email,"
should be:
"email: email || userProto.email,"

otherwise, "name:" is a duplicate key from the line immediately preceding it (line 13).

Glenn Cueto  Feb 16, 2015 
PDF Page 54
2nd paragraph

> Simply pass any object into Object.create(), and it will be be (snip)

"be be" -> "be"

iwanaga  Jul 18, 2014 
PDF Page 72
"Substitutable" paragraph, end of first line

"substitute one module with another, as long is"

should be

"substitute one module with another, as long *as*"

  Sep 24, 2014 
Printed Page 96
If manually building/ browserifying rather than automating with Grunt

Grunt did not work as planned, even if manually installing and running browserify (so public/app.js becomes 9395 lines of code) I am still seeing failing tests.

It would be extremely useful if up to date code examples could be provided for this book?

Thanks

Leigh Mathieson  Jul 22, 2017 
PDF Page 101
5th

In the first line, "microlibary" should be "microlibrary".

sandbox wang  Nov 05, 2015