Errata

JavaScript Enlightenment

Errata for JavaScript Enlightenment

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
ePub Page chap 8 last section
3rd para

Chap 8, section "Replacing the prototype Property with a New Object Removes the Default Constructor Property
" instructs that default ctor needs to be reset when prototype is set to a new object.

In example should Chef's constructor prop be set to "Chef"

ex:

Chef.prototype.constructor = Chef;

thanx

jra

John Aldrin  May 30, 2013 
Printed Page 3
Last paragraph, second to last sentence

Hi!

This sentence reads:
"If you examine both of the objects produced, you will see that they are identical objects in substance but not in type."

I'm confused -- aren't these two objects also identical in type? `typeof myObject === typeof myString` is true here.

I think this might just need different word choice.

Enjoying the book! Thank you!!
Matt

Matthew Malinowski  Jun 01, 2013 
PDF Page 10
4th paragraph

"It's possible to forgo".
It should be written: "It's possible to forgot"

Diogo Barros  Aug 28, 2013 
PDF Page 19
Note at bottom of page

The following two statements in the bottom note, as they relate to references, are misleading:

"Primitive values are not ?referenced by value? and cannot represent
a composite (i.e., a thing made up of several parts or elements)
of other values. Complex objects, on the other hand, are ?referenced by
value? and can contain or encapsulate other values."

Primitive variables store primitive values and are indeed referenced by value. Reference variables store an address to the object and are not referenced by value, rather, by memory address (reference, pointer, etc.)

Anonymous  Dec 10, 2013 
PDF Page 38
last paragraph

In the last paragraph on the page, it says...

"...the prototype chaining rule is invoked and JavaScript looks for the property in the Array constructor?s prototype property (e.g., Array.prototype). It is not there either..."

I was curious about what the toLocaleString did so I looked at the definition on the Mozilla Dev Network here...

https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toLocaleString

It says...

"This function is provided to give objects a generic toLocaleString method, even though not all may use it. Currently, only Array, Number, and Date override toLocaleString."

So to test this (I'm on Chrome on a Mac) I ran this...

var myArray = ['foo', 'bar'];

console.log(Array.prototype.hasOwnProperty('toLocaleString'));

and it returned 'true.'

I don't know if this is an ECMAScript version-specific issue or if this is an error in the book. I'll leave it for you to determine.

Bob Monsour  Jan 11, 2013 
PDF Page 41
3rd bullet of the Notes

The notes indicate that when not using the hasOwnProperty test in the "for in" loop you would get properties that are inherited from the parent objects in the prototype chain. It also says that you'll only get those that are enumerable.

When I run console.log(key); in your example WITHOUT using the hasOwnProperty test, I only get age and gender in the log output.

Is it safe to assume that this means that the Object() object, while having other properties, has none that are enumerable?

Thanks.

Bob Monsour  Jan 11, 2013 
ePub Page 51
code example

I can't provide the exact page numbers because the e-Readers all seem to think they are different. But there is a class of errors that I think you are aware of because the "Live Code" examples shown in jsFiddle seem to be mostly correct. The error is that in the text, the comments which indicate what the output SHOULD be don't match the actual output. Also the reference to what a "modern" browser should show doesn't always match either.

Minor but just annoying enough to be distracting.

Don Albertson  May 03, 2013 
Printed Page 52
Notes 2nd bullet

in the second bullet of Notes it says:

"...[e.g., new Function('x', 'return x') versus function(('x', 'return x)]."

I can't make sense of the function expression after the 'versus', even after fixing the parentheses. Does that expression, once it is fixed up, work in some context?

Great book by the way.

Tom Skinner  Oct 18, 2013 
ePub Page 72
United States

Indicates "See Chapter 1" for content that is actually in Chapter 2.

Matt Chapman  Jul 09, 2013 
Mobi Page 2104
United Kingdom

At location 2104 in Kindle, the function reads "var add = new Function(' x', 'y', 'return x + z');" Presumably, it should actually return x + y? (I realize that z could be a global, but that would be an unwelcome complication).

William Hudson  Jun 04, 2013