JavaScript Step by Step

Errata for JavaScript Step by Step




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
Safari Books Online
Ch. 3
Exercises at end of chapter

There was already an errata posted on this question, but the original poster (Gary) didn't give the correct result (I think) - it looks like to me that the correct answer for exercise 1 should be everything except a & e are correct. The reason I responded like this is a) if (var == 4) {// do something} this statement is incorrect because var is a keyword a case could be made that this is syntactically correct, but the results would be unpredictable. b) var testVar = 10; this statement is correct testVar is declared and assigned a value of 10 c) if (c == b) {// do something} this statement is correct c is compared to b and if they are the same the code between the {} is executed d) testVar = 10; this statement is correct (we are not told whether or not the script is in strict mode nor whether or not the var has already been declared - but under certain conditions - this statement is correct) e) var case = "Yes" this statement is incorrect because case is a reserved word

Note from the Author or Editor:
You are correct. In the second edition, A and E are the "Correct" answers and they are not valid.

Anonymous  Aug 30, 2012 
Safari Books Online
Ch. 4
Section 4.2.4.1 Writing the date and time to a webpage

The section, step 1, says to edit the file writingthedate.htm in the chapter 4 sample files of the companion content. I downloaded the companion content for this book from the link provided on the Safari Website. The download didn't include the file mentioned in chapter 4 as indicated in the book, however a file of that name did appear in the chapter 8 completed code folder.

Anonymous  Aug 30, 2012 
Safari Books Online
5.5.1
Testing the equality operators

Step 2 "Replace the TODO with the boldface code below" yet none of the code below is boldface. It's easy to tell which should be added, so it's no big deal, but the font is not bold as described.

Anonymous  Sep 04, 2012 
Printed
Page 8
Second html code sample

The <html> tag is missing. It should be added as the first line of the example.

John Hubbard  May 01, 2011  Aug 05, 2011
Printed
Page 47, 430
Exercise 1

On p.47, exercise 1. It ask to insert the script in the body. Looking back in the answers section on p.430, it has it inside the head section.

Note from the Author or Editor:
To correct this errata, move the script within the <body> element. The correct version should read: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>My Second Page</title> </head> <body> <p>My Second Page</p> <script type="text/javascript"> alert("Steve Suehring"); </script> </body> </html>

Gary Lee  Jan 17, 2011  Aug 05, 2011
Printed
Page 60, 431
Exercise 1a

On p.60, exercise 1a. It ask whether this statement is valid: if (var == 4) { //Do Something } This statement is not valid because "var" is a reserved word, however, the answers on p.431 shows it as a valid Javascript statement. So the answers for CH.3 Ex.1 is "a" and "e".

Gary Lee  Jan 19, 2011  Aug 05, 2011
Printed, PDF
Page 89
screenshot

On page 89 of the pdf where the date object is being discussed and the delay script implemented the browser screenshot should display the delay time. Instead, it displays an alert window showing chapter two.. Looks as if you used myfirstpage.htm instead of render.htm No biggie..

Note from the Author or Editor:
This is indeed an error. The screenshot should state "Page rendered in 0.62500 seconds."

Fernando  Feb 15, 2011 
Printed
Page 93
Second paragraph after Table 4-7

I don't know that this is an error, but I'm very confused by it. It says: "However, when working with regular expressions, using methods native to the [String] type, such as [match], [search], [replace], and [her from the bank], is just as common" [ ] = italics The "her from the bank" part is what is making no sense to me. Is that correct? It doesn't sound like it would be the name of a method.

Note from the Author or Editor:
Thanks for the report. I have no idea what that is or how it got there, but your diagnosis is correct. The new sentence should read: "However, when working with regular expressions, using methods native to the String type, such as match, search, replace, are just as common."

Anonymous  Aug 06, 2012 
Printed
Page 108
code at the top of the page

The code creating the myArray array should use square brackets rather than parentheses.

Steven Choinski  Aug 31, 2012 
Printed
Page 144, 145
Step 5, Step 6

Step 5. is missing the word nancy after the word name. nancy should be in bold typeface. Step 6 is missing the words someone else after the word name. someone else should be in bold typeface.

Kent Wilbur  Nov 23, 2012 
PDF
Page 176
cutStars variable the value ôVega,Altair

Should returns value of cutStars variable as "Vega" only

Note from the Author or Editor:
Change from slice(2,3) to slice(2,4) to get intended/documented result.

Anonymous  Mar 13, 2013 
Printed
Page 177
the last piece of code on the page

missing ");" at the end of the code

Note from the Author or Editor:
In the example provided describing the forEach() method on this page, the last example should contain a ); to close the function.

Anonymous  Apr 04, 2011 
Printed
Page 182
the screenshot

Figure 9-1 says to show the window object and its children, but instead the screenshot illustrates the location object (the same screenshot is used on p.191).

Anonymous  Apr 04, 2011 
Printed
Page 204
Readeraid on Top of Page

Within the "Note" readeraid on the top of this page, the last sentence reads, "DOM Level 0 is also known". This sentence should actually be the first sentence of the next paragraph and should read: DOM Level 0 is also known as the legacy DOM. This errata showed up after the final manuscript had been reviewed by me. Steve

Steve Suehring
O'Reilly Author 
Dec 30, 2010  Aug 05, 2011
Printed
Page 267
Example step 3 screenshot

Step three reads, "View the page in a web browser. You should see a page like this ..." No, you shouldn't. The image shows both a "Previous" and "Next" button, but you haven't added the code for a "Previous" button yet. Just cover the "Previous" button with your thumb, or something.

Benjamin Robinson  May 10, 2011 
Printed
Page 302
Item 5

The error is not in the page but in file form.js in the companion content which omits the argument "eventObj" in the first line of function checkValid().

Steven Choinski  Oct 12, 2012