Learning JavaScript by Shelley Powers The following errata were *corrected* in the 5/08 reprint. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification (4) 1st paragraph; "When you're visiting web pages and curious as to how..." s/b "When you're visiting web pages and ARE curious as to how..." (4) Note; EMCA-262 should be ECMA-262 6) 2nd sentence under "First Look at..." heading; "All you need to do, at a minimum, is include HTML..." s/b [bc of parallel construction] "All you need to do, at a minimum, is TO include HTML..." (7) 2nd sentence in 1st paragraph; "If it doesn't, chances are that JavaScript is disabled in the browser, or,..., Javascript isn't supported." s/b [bc of parallel construction] "If it doesn't, chances are that JavaScript is disabled in the browser, or,..., THAT Javascript isn't supported." {7} Example 1-1: Body tag in Example 1-1 should read: (25) 4th paragraph; This chapter covers the the three basic... should be This chapter covers the three basic... {26} The reserved word 'public' is listed twice; disregard the second occurrence. (26) var-ident should be var_ident (28) validate-name should be validate_name (28) The sentence that reads, "Though you can use the $, number, or underscore to begin a variable, your best bet is to start with a letter." should read "Though you can use the $, letters, or underscore to begin a variable, your best bet is to start with a letter." {29} mid-page; The current link is: http://dojotoolkit.org/developer/StyleGuide {31} 2nd paragraph, 2nd sentence; "The first, global.js, concatenates it's own string, globally in globalPrint, to the message." "globally in globalPrint" should be in fixed font to demonstrate it is a literal string {31} the second block of code, which begins with: message += " globally in globalPrint"; Since the variable is undefined, this generates an error in Firefox 2.x (though not necessarily other browsers, or earlier versions of Firefox). To prevent, use: if (typeof(message) != 'undefined') message += " globally in globalPrint"; (36) 1st text paragraph; "...block in Example 2-1 is replaced..." should be "...block in Example 2-2 is replaced..." {38} Examples of floating point numbers in middle of page should read (to O'Reilly, note about superscript): 0.3555 144.006 -2.3 44.1(2) // note that the 2 should be typographed as superscript 19.5(e-2) (which is equivalent to 19.5(-2)) // note that the e-2 and -2 should be superscript {39} Sentence that reads "You can convert strings or booleans to numbers..." should read "You can convert strings to numbers..." (40) 1st paragraph under "Null and Undefined"; more so then should be more so than (43) Question 4; hexidecimal should be hexadecimal {44} 2nd code snippet at bottom of page; var bValue = true; var sValue = "this is also true" should end with a semi-colon, like - var bValue = true; var sValue = "this is also true"; (46) The sentence starting with "Usually, I should add,..." should read "Most complex JS libraries are 'usually' not more than a few hundred lines, because some of the newer Ajax libraries can be quite large." (48) Sentence that reads " - Represents a negative value" Should read " - Changes sign of value (50) 4th block of text; we're typed out should be we've typed out (50) Under "Bitwise Operators"; there is excellent Boolean algebra reference should be there is an excellent Boolean algebra reference (50) Code snippet nValue += 3.0; should be nValue += 30; {51} The code snipped mid-page should read: var flag_A = 0x1; var flag_B = 0x2; var flag_C = 0x4; var flag_D = 0x8; {52} To validate, Example 3-1 needs a closing body tag. {58} The code for the switch statement should be: switch (stateCode) { case 'OR' : case 'MA' : case 'WI' : statePercentage = 0.5; taxPercentage = 3.5; break; case 'MO' : taxPercentage = 1.0; statePercentage = 1.5; break; case 'CA' : case 'NY' : case 'VT' : statePercentage = 2.6; taxPercentage = 4.5; break; case 'TX' : taxPercentage = 3.0; break; default : taxPercentage = 2.0; statePercentage = 2.3; } (58) The line starting with "In this instance, the case values associated with the block are separated from the others by commas, which means any of the three can match." should be "In this instance, the case values all resolve to the same block, which means any one of the three can match." (59) Delete the sentence It's identical in behavior to listing out the options, separated by commas.