Errata


Print Print Icon

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 "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



Version Location Description Submitted By Corrected
Safari Books Online ??
Section 13.1.1 code example below, marked with <<<----

The line marked below is not complete. Should it be competed with " val2);".

Number.prototype.add=function(val1,val2) { return val1 + val2; };
var num = new Number();
num.prototype.add = function(val1, <<<----
var sum = num.add(8,3); // sum is 11

Note from the Author or Editor:
The following line should be removed (it was left in by accident):

num.prototype.add = function(val1,

The actual example should read:

Number.prototype.add=function(val1,val2) { return val1 + val2; };
var num = new Number();
var sum = num.add(8,3); // sum is 11

Bill Judd 
Safari Books Online ??
Example 8.5

In example 8.5 the line

<textarea name="text4" cols="50" rows="10">The text area</textarea>

should read

<textarea name="text4" id="text4" cols="50" rows="10">The text area</textarea><br /><br />

Note from the Author or Editor:
In Example 8-5, the line defining the textarea element should be changed to:

<textarea name="text4" id="text4" cols="50" rows="10">The text area</textarea>

Steven Greve 
Safari Books Online ?
Section 7.2.2

Just a trivial typo...

The text below example 7.4 says that the alert windows shown by clicking on the innermost div will be:

1. Select element event
2. First element event
3. Document event

However, according to the listing in example 7.4 it should say:

1. ***Second*** element event
2. First element event
3. Document event

Note from the Author or Editor:
The text before Example 7-4 should be corrected to read:

1. Second element event
2. First element event
3. Document event

Shane Bell 
Safari Books Online 2.6
5th code example in section 2.6

The code snippet reads:

if (sValue) // true if a variable is both defined and given a value (including empty string)

This is in error. An empty string evaluates to false, as shown in this code:

var someVar = "";
if (someVar) {
document.writeln("<p>someVar evaluates to TRUE</p>");
}
else {
document.writeln("<p>someVar evaluates to FALSE</p>");
}

Note from the Author or Editor:
The code snippet should read:

if (sValue) // true if a variable is both defined and given a value

Anonymous 
Safari Books Online 3.2
6th example

The example reads:

var nValue1,nValue2 = 3; // nValue2 is undefined

But it should certainly read:

var nValue1,nValue2 = 3; // nValue1 is undefined

Note from the Author or Editor:
The current 6th example in Section 3.2 and the line of text preceding it currently read:

However, with the following, where variables are lined up with commas between them, the first variable is set and the second ends up undefined:

var nValue1,nValue2 = 3; // nValue2 is undefined

It should read:

However, with the following, where variables are lined up with commas between them, the second variable is set, and the first ends up undefined:

var nValue1,nValue2 = 3; // nValue1 is undefined

Anonymous 
Safari Books Online 3.2.5
binary flags example

The flags value is set to 0101, and the flag 'order' is apparently ABCD (A/C false, B/D true).

[quote]
flag A: false
flag B: true
flag C: false
flag D: true
[/quote]

>> C is false!

But then the flag order is reversed to DCBA:

[quote]
Each bit mask flag is then represented as follows:
var flag_A = 0x1; // 0001
var flag_B = 0x2; // 0010
var flag_C = 0x4; // 0100
var flag_D = 0x8; // 1000
[/quote]

>> C is true (suddenly)!

Note from the Author or Editor:
Page 46 in chapter 3, the code example from Mozilla that reads like:

flag A: false
flag B: true
flag C: false
flag D: true

should read:

flag A: true
flag B: false
flag C: true
flag D: false

The values were transposed

Anonymous 
Printed Page 7
Code sample at bottom of page

function hello(??) {

should be

function hello() {

Note from the Author or Editor:
Remove the ?? in the code sample at bottom of page 7

Conrad Halling 
Printed Page 20
Between 3rd and 4th paragraphs

var-ident should be var_ident

Note from the Author or Editor:
The variable name example var-ident should be var_ident at the top of page 20.

Conrad Halling 
Printed Page 20-21
Table 2-1, Table 2-2

Three additional keywords, omitted from Table 2-1, are null, true, and false.

The reserved word public is listed twice in Table 2-2.

Note from the Author or Editor:
The reserved words null, true, and false should be added to Table 2-1 and the duplicate public should be removed from Table 2-2

Conrad Halling 
Printed Page 22
Last paragraph

"Though you can use a dollar sign, number, or underscore to begin a variable..."

should be

"Though you can use a dollar sign, letter, or underscore to begin a variable..."

Note from the Author or Editor:
Page 22, last paragraph, first line from

Though you can use a dollar sign, number, or underscore to begin a variable...

to

Though you can use a dollar sign, letter, or underscore to begin a variable...

Conrad Halling 
Printed Page 29
2nd and 3rd paragraphs, table 2.4

Although on page 28 the book discusses using the String() global function for converting a variable to a string, the top of page 29 suddenly refers to toString(). My experimentation with this function (which is actually a method) showed that String() and toString() do different things.

toString should be changed to String in paragraphs 2 and 3 and table 2-4 of page 29.

Note from the Author or Editor:
toString should be changed to String in paragraphs 2 and 3 and table 2-4 of page 29.

Conrad Halling 
Printed Page 33
5th paragraph

In discussing the parseInt function, the example indicates that parseInt("266",16) results in a value of 550. Although my understanding of converting to hex and octal is rudimentary, my code indicate that the result is 614, not 550. I'm not sure if the difference between my result and that of the author is my mistake or not, but I ran the code verbatim, and my result is different.

Note from the Author or Editor:
The use of parseInt("266","16") shown in page 33, paragraph 5, results in a value of 614, not 550 as shown in the book.

Eric Brown 
Printed Page 64
3rd paragraph

The 3rd paragraph states: "...Example 3-8 creates a custom object named MyTest...." but the custom object in code Example 3-8 is actually named MyText instead.

Note from the Author or Editor:
The object referred to as MyTest in sentence 3, paragraph 3, page 64, should be MyText.