Errata

Head First JavaScript Programming

Errata for Head First JavaScript Programming

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. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

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

Version Location Description Submitted By Date submitted Date corrected
Chapter 11: Extreme Javascript Challenge Revisited

In the answer for Specimen #2, the following line should NOT have the parenthesis because it is supposed to be returning a function reference:

return getValue();

Two other code references earlier in the same chapter have this line code correct.

Note from the Author or Editor:
I'm not seeing the parentheses on the return statement for specimen #2 in the print book.

However the version in Safari books online is wrong. Please fix.

In the "How the Click me! closure works" section on Safari, under Extreme JavaScript Challenge Revisited, under Specimen #2, the line

return getValue();

should read

return getValue;

David Greiman  Apr 13, 2014  May 30, 2014
Printed
Page n/a
cover

"Avoid embarrassing typing conversion mistakes" should read "Avoid embarrassing type conversion mistakes".

Note from the Author or Editor:
Wow. Yeah, we missed this one! On the cover. That *IS* embarrassing.

Please replace "typing" with "type".

Anonymous  Mar 25, 2016  Mar 10, 2017
Printed
Page 3
1st image

The image of HTML code is missing the ending </head> tag.

Note from the Author or Editor:
Fixed

Vincent Yang  Jul 10, 2014  Aug 22, 2014
9
Chapter 9 setInterval Exercise

I don't have a page number because I am using SafariOnlineBooks on my IPAD. In Chapter 9 there is an exercise that uses setInterval to display the value Tick or Tock. The output should say Tick then tock and so forth. The example in the book only shows the value Tick. At the end of the chapter where the answers are, the values are correct.

Note from the Author or Editor:
Please fix in Safari. It's fine in the printed book and PDF.

Anonymous  Apr 18, 2016  Mar 10, 2017
Printed, PDF
Page 15
Annotated code statement near top

The annotation "And this whole thing is an expression" is too long - it includes the semicolon that terminates the statement. Instead, it should stop just before the semicolon.

Note from the Author or Editor:
Fixed!

Jeff Straw  May 30, 2014  Aug 22, 2014
Mobi
Page 40
Several places

In the "Sharpen Your Pencil" solution, all of the untrue values are listed as "Flase".
- if the "true" values are lower case, the "false" values should be as well.
- the false value is misspelled identically everywhere.
- the third answer for the "yourLevel > 5" is listed as "Flase", but it should be "true".

This error is only seen in the Mobi version. The PDF is correct.

Scott Hankin  Apr 04, 2014  Apr 09, 2014
Printed
Page 53
The one line of JS code and corresponding image

The string provided to the prompt function is different from the string in the prompt dialog box that displays when prompt is called. The string in the code is missing the word ?from,? which appears in the dialog box between ?number? and ?0?6.? The same assignment statement also appears on p. 52, second to last line of code.

Note from the Author or Editor:
fixed

Vincent Yang  Jul 18, 2014  Aug 22, 2014
Printed
Page 53
1st paragraph, last line

A space appears between the word ?anything? and the comma.

Note from the Author or Editor:
fixed

Vincent Yang  Jul 18, 2014  Aug 22, 2014
Printed
Page 62
First paragraph, last sentence

The sentence reads ?So, you see, these conditions can get complex.? The word ?conditions? should read ?conditionals.?

Note from the Author or Editor:
fixed

Vincent Yang  Jul 25, 2014  Aug 22, 2014
Printed
Page 63
Last annotation

The annotation reads ?Notice we?re using parentheses to group the conditions together?? The word ?conditions? should read ?conditionals.?

Note from the Author or Editor:
fixed

Vincent Yang  Jul 25, 2014  Aug 22, 2014
Printed
Page 63
1st paragraph

In the sentence that reads ??we can combine boolean operators in multiple ways?,? the words ?boolean operators? should read ?conditionals.?

I previously reported this error, which I don?t see listed in the confirmed errata list.

Logical operators combine conditionals. They?re not themselves combined. The example shows the conditionals inStock == true, onSale == true, and price < 60 being combined. The && and || boolean operators combine these conditionals. Shouldn?t the sentence say ??we can combine conditionals in multiple ways???

Note from the Author or Editor:
Here we are using multiple boolean operators in one big conditional. That's what we meant by "combining". Perhaps unclear, so I've reworded as: "we can use multiple boolean operators to combine conditionals in a variety of ways"

Vincent Yang  Aug 09, 2014  Aug 22, 2014
Printed
Page 77
Annotation near middle of page

In the annotation that begins with ?But, with the boolean OR operator we can combine the tests so that if location matches any of location1, location2 or location3??, the word ?location? should read ?guess? (i.e., the variable).

Note from the Author or Editor:
fixed

Vincent Yang  Jul 22, 2014  Aug 22, 2014
Printed
Page 88
4th block from end

There is a posting (from Mr. Yang) that is still under _unconfirmed_.

Where it is pointed out that the text says "passing values as parameters" when it SHOULD say arguments.

In fact the 5th from last paragraph says: Function: Oh, that's just another name for the values you pass into a function... they're the arguments of the function call."

But then the 4th.. Head First: Well you don't seem all that great... I mean, okay you allow me to reuse code, and you have this way of passing values as parameters. Is that it? ... "

Don't these two things contradict themselves? And kinda prove that this should be in the CONFIRMed errata?

Cheers

Note from the Author or Editor:
Change "Well you don’t seem all that great; I mean, okay you allow me to reuse code, and you have this way of passing values as parameters." to

"Well you don’t seem all that great; I mean, okay you allow me to reuse code, and you have this way of passing values into parameters."

4th block from the end, page 88

Raphaeae  Jul 03, 2015  Mar 10, 2017
PDF
Page 120
solution, boxes on the right

Parameters are local variables. So width, height, x1, y1, x2, y2 and r should be added to the Locals box.

Also in the setup function the parameters width and height shadow the global variables,
and should be circled.

Note from the Author or Editor:
fixed part 2; left part 1 (we are distinguishing between local variables and parameters in this exercise).

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
Printed
Page 151
comments on bottom of page code

"Creates another new item in the next open index" Well since you've introduced sparse arrays I think "next open index" could be misunderstood here. My understanding is that it's always after the last array element.

Note from the Author or Editor:
I agree, the language is a bit ambiguous on this.

I've updated the annotations in the files for the next printing.

Dave Murley  Apr 28, 2014  May 30, 2014
PDF
Page 164, 171
[164] right after pseudocode/ [171] 1st and 5th line of code,

pg 164 and 171
function getMostCostEffectiveSolution(scores, costs, highscore)

and

if (scores[i] == highscore)

>>> highscore parameter is all in lowercase.

Note from the Author or Editor:
Fixed for next printing - changed all occurrences to highScore.

Anonymous  May 07, 2014  May 30, 2014
PDF
Page 164
pseudocode, function parameters and the 1st IF statement

It should read "SCORES" instead of "SCORE".

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
Printed
Page 171
"BONUS" section on bottom, and related code file

The alternate solution in the bubbles2.html file has an error. The last line of the getMostCostEffectiveSolution2 function reads cost = costs[i];. It should read cost = costs[solutionIndex];.

Note from the Author or Editor:
Yes, fixed and code in github updated.

Greg Foley  Jul 05, 2014  Aug 22, 2014
ePub
Page 175
Immediately under section heading "Implementing parseGuess"

This is in Chapter 8. I realize that the pagination of the epub version appears to be about half of the printed book, so I am assuming that page "175" in my epub must correspond approximately to page "350" in the printed version?

Below the section heading, there is a table containing descriptions of steps 1-6 for implementing the parseGuess helper function. The language of at least one of these steps suggests that there should be associated images illustrating the steps, and there is some kind of small, indistinct "image" visible at the end of each description. I am unable to make these "images" appear in any kind of usable form, whether by double-tapping them on my nook tablet, or by increasing the magnification in my Windows laptop nook Reader.

Since I only possess the epub version of this book, I cannot say what the page should look like, but it certainly seems like something is wrong/missing in the formatting of this page.

Note from the Author or Editor:
I don't have the epub on a device, so I can't determine if this indeed an error. There is the flowchart on page 351, but otherwise, I'm not sure what image the reader might be referring to.

ORM: We have corrected this for the upcoming 3/10/2017 release.

Bob Kreycik  Aug 11, 2016  Mar 10, 2017
PDF
Page 198
drive method inside the fiat object below the first paragraph

It should have been alert("Zoom zoom!"); instead of alert.log("Zoom zoom!");

Note from the Author or Editor:
yes. I've fixed for the next printing.

Anonymous  May 07, 2014  May 30, 2014
Printed
Page 221
dog.bark listed as answer at bottom of page.

dog.bark listed as answer at bottom of page. Never assigned, bark was and should be answer as printed. Else assign woofs to dog.bark

Note from the Author or Editor:
Yup! It's fixed in the files for the next printing!

Dave Murley  Apr 28, 2014  May 30, 2014
PDF
Page 250
Heading

"event hander" should read "event handler"

Note from the Author or Editor:
Fixed!

Anonymous  Jul 02, 2014  Aug 22, 2014
PDF
Page 267,308
the last item

"I?m the value that can?t be assigned to a property when you create an object." (undefined)

This is a valid JavaScript statement:
var a = {x: undefined};

Note from the Author or Editor:
Yup, don't know what we were thinking. This item is removed from both pages. thanks

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
Printed
Page 289
annotation of top figures

"This reference" and similar point to objects
"these objects'' more or less points to references
As I understand it, the references are represented by the things in the cups and the objects by the round blobs.

Note from the Author or Editor:
Fixed the arrows.

Dave Murley  May 01, 2014  May 30, 2014
Printed, PDF
Page 292
Top half of page

Boolean value false is missing from the list of falsey values, and the text talks of five, though it should say there are six. See also page 306.

Note from the Author or Editor:
Actually false isn't falsey. It's just false. I added an annotation to hopefully clarify a bit.

Jeff Straw  Jul 17, 2014  Aug 22, 2014
PDF
Page 298
all 3 console.logs

It should read
console.log("There is a...");
instead of
console.log("there is a...");

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
Printed, PDF
Page 300
bottom left above the "bowl"

Possible misunderstanding:

Description of toUpperCase method says: "Returns a string with all lowercase characters changed to uppercase."

Original string does not have to be all lowercase but may contain characters of arbitrary case.

Fix: Change "all" to "every"

Note from the Author or Editor:
Fixed

Anonymous  Jul 08, 2014  Aug 22, 2014
PDF
Page 306
Deutschland

The bullet point regarding the five falsey values states that false is falsy. It should read, NaN is falsey.

Note from the Author or Editor:
Already fixed

Thomas L.  May 21, 2014  Aug 22, 2014
Printed
Page 322
annotation of lower right cell

"06" should be "60"

Note from the Author or Editor:
fixed in chapter 8 file.

Dave Murley  May 02, 2014  May 30, 2014
Printed
Page 322
Center of page "This cell has id='06'

The lower left corner of the html table is identified as cell "06". I think this may be incorrect. I think it should be cell id "60".

Great book overall btw!

Best,
Bill

Note from the Author or Editor:
Been fixed, should be in the next reprint.

bill brouillette  Jun 23, 2014  Aug 22, 2014
PDF
Page 322
annotation under the table

It should read
This is cell with id ?66?
instead of
This is cell is id ?66?

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 326
CSS rules at the bottom of the page

Probably should add "transparent" to .hit and .miss,
as in the CSS rules on page 375.

Note from the Author or Editor:
Removed "transparent" from 375, not needed. Page that changed is 375, not 326.

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 343
code at the top of the page and code at the bottom of the page

Missing var:

locations = ship.locations;

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
Printed
Page 352
code at bottom

Not exactly error but firstChar seems to be used as a global through page 354. It's eliminated entirely in final code. Oh, and I'm not sure what a "non-null" string is. Is there such a thing as a "null string"?

Note from the Author or Editor:
It's used in the next line. However there is an error in that we don't declare the variable, so I've fixed that. I've also updated the code online to reflect using this variable (we'd eliminated it by combining that line with the next one).

you're right about "non-null string" there is no such thing as a null string, it should just say null. I've fixed that too. thanks.

Dave Murley  May 03, 2014  May 30, 2014
PDF
Page 352
step #3

It should read
"...array that contains the letters A-G."
instead of
"...array that contains the letters A-F."

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 356
annotation at the bottom of the page

It should read
"...the total number of guesses they took to sink the ships."
instead of
"...the total number of guesses they took to sink the ship."

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
Printed
Page 365
3rd line in code

"var row, col;"
I think use of comma to combine multiple variable declarations hasn't been introduced before. Does it generalize to other situations?

Note from the Author or Editor:
Good catch! Yes, we haven't introduced that. I've split it onto two lines, for two separate variable declarations.

Dave Murley  May 05, 2014  May 30, 2014
Printed
Page 366
United States

To generate the integers 0-4 for the col shouldn't the multiplier be 5 instead of 4 (this.boardSize -2)? The same applies to page 367: this.boardSize - this.shipLength + 1.

Note from the Author or Editor:
Why yes, yes it should. Silly mistake. I've updated to change to 2 on page 366, and modify the annotation, and add 1 to shipLength on page 367.

David W. Wood  May 18, 2014  Aug 22, 2014
Printed
Page 368
in the code for the collision method

The code in the book says we define the variable:

var ship = model.ships[i];

This works but since collision is a method within the "model" object shouldn't we reference the "ships" property in that object by using:

var ship = this.ships{i};

I've tested both ways which work. Is there any hazards to be aware of with one or the other?

Note from the Author or Editor:
In line 3 of the code on page 368 change "model" to "this". The code works either way, but "this" is more correct than "model".

Do NOT change the braces to {}; leave as is as [ ]

Mike  Jun 29, 2016  Mar 10, 2017
Printed
Page 375
solution, 2/3 down the page

The solution says all six guesses are hits. The 1st, 3rd, and 5th ones are actually misses.

Note from the Author or Editor:
fixed

Greg Foley  Jul 29, 2014  Aug 22, 2014
PDF
Page 389
2nd last annotation right

Annotation reads: "We create a function init. and assign it to the onload handler?".

IMHO onload is the event and init is the handler, no?

Fix: change "onload handler" to "onload event".

Note from the Author or Editor:
Changed to read "property" instead.

Anonymous  Jul 20, 2014  Aug 22, 2014
PDF
Page 391
last sentence above "there are no dumb questions"

It should read
"but overuse of globals"
instead of
"but over use of globals"

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 399
last paragraph, 2nd sentence

It should read either
"..and we?ll come back to that in a bit."
or
"...and we?ll come back to that a bit later."
instead of
"...and we?ll come back to that a bit."

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 406
code for showCoords

In the function showCoords the name of the local variable should be "coords" instead of "map":

var coords = document.getElementById("coords");
...
coords.innerHTML = ...

Note from the Author or Editor:
fixed this and solution on 424.

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
Printed
Page 412
1st code block

window.onload is now set to a anonymous function instead of to an init function as instructed on p. 389 and 390, but the notation next to the code states "This code is just as we wrote it before. No changes here..."

Note from the Author or Editor:
change "window.onload = function() {" to

window.onload = init;
function init() {

at the top of the code on page 412.

Tom Odon  Aug 04, 2016  Mar 10, 2017
Printed
Page 413
Third question

The Question asked about showAnswer defining reblur "in its code". As listed in text, it's separate. That works. I tried inserting reblur's definition inside showAnswer and that worked too.

Note from the Author or Editor:
modified the wording slightly.

Dave Murley  May 07, 2014  May 30, 2014
PDF
Page 413
1st sentence in the last question

It should read "setTimeout" instead of "setTmeout".

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 415
Code line 7

Inconsistency between book and example code:

Book: function resize() { ? }
Example: function resize(e) { ? }

Parameter "e" is used nowhere in code.

Fix: remove "e" from example code.

Note from the Author or Editor:
fixed in code

Anonymous  Jul 22, 2014  Aug 22, 2014
PDF
Page 420
Crossword, 19 across

clue 19 across: "The event object for a mouseover event has this property for the X position of the mouse."

It is not made clear which of the three possible X-properties is wanted (clientX).

Possible fix: "?of the mouse in relation to the browser window." (or something down that line? ;)

Note from the Author or Editor:
fixed

Anonymous  Jul 22, 2014  Aug 22, 2014
PDF
Page 420
21 across

change "time event" to "timer event"

Note from the Author or Editor:
fixed

Anonymous  Jul 22, 2014  Aug 22, 2014
PDF
Page 443
Brain Power, bottom right

"Think about how you?d write code to perform these three tasks (no-fly list, paid customers and a list of passengers)?"

Should end with full stop, not question mark.

Note from the Author or Editor:
fixed

Anonymous  Aug 05, 2014  Aug 22, 2014
PDF
Page 444
annotation for code example (printPassenger)

Annotation for printPassengers(passengers) :

Is: "And print is different?"
Should be: "And printPassengers is different?"

Note from the Author or Editor:
fixed

Anonymous  Aug 05, 2014  Aug 22, 2014
PDF
Page 444
annotation under the 1st block of code

It should read
"... on a no-fly list"
instead of
"... on a no fly list"

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 444
3rd block of code, printPassengers function

Because of the "return false;" the function will print only the first name.

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 445
1st sentence

It should read
"... on the no-fly list"
instead of
"... on the no-fly-list"

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 447
1st console.log(...)

It should read
"... on the no-fly list"
instead of
"... on the no-fly-list"

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
Printed, PDF
Page 449
Definition of function fun near the top

Minor point - the semicolon is unnecessary at the end of the fun function declaration.

Note from the Author or Editor:
fixed

Jeff Straw  Jul 23, 2014  Aug 22, 2014
PDF
Page 451
7th para (Jim)

Jim: "Have you looked at the setTimeout API":
Occurs also in p 453 ("API-specific events")...

The term "API" ist not yet introduced or explained.

Possible fix: Add dialogue of Frank asking "What do you mean by API?" Have Jim explain.

Note from the Author or Editor:
Actual book pages for this are 411 and 413.
I updated 411; left 413 as is.

Anonymous  Jul 22, 2014  Aug 22, 2014
PDF
Page 454
1st annotation for the serveCustomer function

It should read
"createDrinkOrder now returns..."
instead of
"getDrinkOrder now returns..."

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 454
annotation for the 2nd alert

It should read
"... a coach class order."
instead of
"... an coach class order."

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 468
code for the printPassenger function

if (passenger.paid === true) {
should be replaced with
if (passenger.paid) {

This is exactly what was mentioned in the "Can we talk about your verbosity..." on page 65.

And there is no need for "return false;" at the end of the function, because at this point a reader knows that without that statement the function will return undefined, which is falsy.

Note from the Author or Editor:
left the return false, but removed the === true

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
Printed, PDF
Page 475
near bottom of page

Extra "s" in "JavasScript"

Note from the Author or Editor:
Fixed

Jeff Straw  Jul 23, 2014  Aug 22, 2014
Printed
Page 479
cookieAlarm function delcaration

this is a function declaration -- ending semi-colon not needed.

Note from the Author or Editor:
Remove semi-colon after the cookieAlarm function definition (after the closing }).

So it will read:

function cookieAlarm() {
alert("Time to take the cookies out of the oven");
}

Anonymous  Jan 12, 2016  Mar 10, 2017
Printed
Page 483
code

Missing var on for loops.

I fixed it.

Elisabeth Robson
Elisabeth Robson
 
Jul 25, 2014  Aug 22, 2014
Printed
Page 484
3rd from bottom paragraph

"Function declarations create functions that are defined everywhere in your code."
Well I guess it depends on what "everywhere" means because on the very next page we learn nesting qualifies this. Chapter 11 is replete with such examples. Good try guys, and I haven't found anyone doing a good job, but the whole chapter needs a rewrite. Not having an understanding of what the current value of a variable is leads to very bad code. Maybe "function scope" should be introduced earlier. My sympathies to the authors.

Note from the Author or Editor:
I clarified the wording with "at the top level"; hopefully that helps.

Dave Murley  May 15, 2014  Aug 22, 2014
Printed
Page 505
"Update..." annotation

Seems like the annotation may have moved up the page, now points to </style> when the script section was intended.

Note from the Author or Editor:
Moved the annotation down a bit.

Dave Murley  May 14, 2014  Aug 22, 2014
PDF
Page 517
top right

soluton -> solution :)

Note from the Author or Editor:
Fixed in indd

J�rgen W. Lang  Aug 20, 2014  Mar 10, 2017
PDF
Page 523
code for rocketCar and tbird objects

There is a comma on the left side of the started property.

Note from the Author or Editor:
weird! fixed.

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 536, 558
the drive method in the exercise and solution

On page 536 the drive method prints the messages to the console,
but the solution on page 558 uses alerts.

Note from the Author or Editor:
fixed on page 558

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 542
example code line 7

Duplicate closing tags in example file:

</script>
</head>
<body>
</body>
</html>

Note from the Author or Editor:
Update in code only (github)

J�rgen W. Lang  Aug 21, 2014  Mar 10, 2017
PDF
Page 550, 551
3rd annotation on page 550 and answer for the 1st question on page 551

Page 550: "If you pass more than one argument, this creates an array holding the values you pass it."

It is possible to create an array by passing just one argument to the constructor:
var a = new Array("100");
It creates an array with one element: a[0] = "100".

Page 551: "So if the Array constructor has zero arguments, the constructor knows it is creating an empty array; if it has one argument it knows that?s the size of the array, and if it has more, then those arguments are all initial values."

According to the docs: "A JavaScript array is initialized with the given elements,
except in the case where a single argument is passed to the Array constructor and that argument is a number."
(see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)

Note from the Author or Editor:
I'm ignoring the edge case of Array("100"), and so I just updated the NDQ answer on page 551 to reflect that the one argument should be a number. Thanks.

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 561
top right

Image is covering up all but last three letters of the page heading. Fix by removing page heading from this page, or adjust image.

Elisabeth Robson
Elisabeth Robson
 
Mar 24, 2014  May 30, 2014
PDF
Page 566
code for the bark method

On page 566 the dogs are barking using alerts,
but on pages 576, 577 and in the rest of the book the dogs are barking to the console.
So I suggest to change the code on page 566 to use console.logs too.

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 566
bottom right corner, top code comment

The comment says: "…each dog has its own bark function…". Since we're talking objects here, should this not be "bark method" instead?

…just sayin'… ;)

Note from the Author or Editor:
EDITOR: Fixed a typo on this page and updated one annotation, both checked into svn.

Jørgen W. Lang  Aug 22, 2014  Mar 10, 2017
Printed
Page 574
solid line code magnets

You only have four, five are needed.

Note from the Author or Editor:
Good catch! I added two more ;-)

Dave Murley  May 18, 2014  Aug 22, 2014
Printed, PDF
Page 574, 615
In owner magnets

Values for the owner property - Dr. Morbius and George Jetson - are strings, so they should be enclosed in quotation marks.

Note from the Author or Editor:
yes, fixed on both pages.

Jeff Straw  Aug 07, 2014  Aug 22, 2014
Printed
Page 579
the whole page

The only info on Robby and Rosie seems to be the Code Magnets on page 574. Seems like info on the methods definitions are missing in the text as only "code goes here" comments are present. They are in the completed solution on page 613.

Note from the Author or Editor:
I added a sentence to the annotation telling readers to use their solution from the code magnets to create the robots. Hopefully that adds clarity.

Dave Murley  May 18, 2014  Aug 22, 2014
Printed, PDF
Page 581 (and 583, 617)
Code 1/3 from top

An extension of / follow-up to Dave Murley's posting of May 18, 2014: Semicolons are missing at the ends of several assignment statements. For example, from page 581,
Dog.prototype.sit = function() { console.log(this.name + " is now sitting"); }
Although the function expression doesn't need a semicolon, the assignment of the expression to Dog.prototype.sit does need one. On pages 583 and 617, this appears for Game.prototype.play and Game.prototype.unlock assignment statements.

Note from the Author or Editor:
Yes, fixed on 581, 583, 617.

Jeff Straw  Aug 08, 2014  Aug 22, 2014
Printed
Page 583, 617
assignment statements, sample output

Per page 13 in the regular text assignment statements are terminated with semicolons. None are used in the exercise, the solution or the download code.

The sample output is wrong as per the code Robby gets the laser first.

Note from the Author or Editor:
I fixed the output but need clarification on the other part of the errata. Not sure what you mean by "regular text assignments are terminated with semicolons".

I've checked the code and it looks to me like I'm using semicolons in all the right places...

Dave Murley  May 18, 2014  Aug 22, 2014
Printed
Page 597
annotation 2/3 down page

" We're adding all these properties ..." points to functions which you have been careful to call methods and separately list in your new format object diagram.

Note from the Author or Editor:
Yeah we probably shouldn't make that distinction so much; it's important to understand that methods *are* properties. I've modified the annotations just a bit hopefully to make that clear.

Dave Murley  May 19, 2014  Aug 22, 2014
Printed
Page 597
First line in the gray box

This line:
Showdog.prototype.league = "Webville"

Should be:
ShowDog.prototype...

The 'd' in Showdog shouldn't be lowercase.

Note from the Author or Editor:
Replace "Showdog" with "ShowDog"

Jeff  Dec 23, 2016  Mar 10, 2017
PDF
Page 610, 611
the sentences array and JavaScript console

The "Let's touch base..." sentence should end with full stop.

Note from the Author or Editor:
fixed

Nikolai Lavsky  Aug 05, 2014  Aug 22, 2014
PDF
Page 619
annotation top right, 2nd sentence

Original: "…so all robots will inherit these methods."

From my understanding only robots based on the Space Robot prototype will inherit these but not Robbie and Rosie.

Suggested fix: "…so all space robots will inherit these methods."

Note from the Author or Editor:
I fixed page 619 to reflect this change.

Jørgen W. Lang  Aug 27, 2014  Mar 10, 2017
PDF
Page 621
code for the palindrome method

If a string is a palindrome and has an even length,
the function will check all the characters twice.

For example, if we execute
"noon".palindrome();
the function will compare characters at position 0 and 3, 1 and 2, 2 and 1, 3 and 0.

We can fix that by changing the test in the for loop and by removing the 2nd if statement:

String.prototype.palindrome = function() {
var len = this.length - 1;
for (var i = 0; i < len/2; i++) {
if (this.charAt(i) !== this.charAt(len - i)) {
return false;
}
}
return true;
};

This code works correctly and does the minimal number of comparisons in all cases.

Note from the Author or Editor:
Yes! Slightly more efficient code. Except I think you need the <= on the for loop.

EDITOR: I've updated page 621 in SVN to reflect this change.

Leonid Popov  Sep 19, 2014  Mar 10, 2017
Printed
Page 633
last annotation on page

the word "of" is missing from " ... part the string ..."

FINI
Thanks guys, I learned a lot.

Note from the Author or Editor:
Fixed

Dave Murley  May 22, 2014  Aug 22, 2014
9999

http://techbus.safaribooksonline.com/book/programming/javascript/9781449340124/7dot-types-equality-conversion-and-all-that-jazz-serious-types/chair_wars_left_parenthesisor_how_really_html

Under the section Bullet Points, the following fails to mention NaN as one of the five type mentioned earlier in the chapter:

JavaScript has five falsey values: undefined, null, 0, ?? (the empty string) and false. All other values are truthy.

Note from the Author or Editor:
Yup! Fixed in the files for next printing.

David Greiman  Apr 10, 2014  May 30, 2014