The very first sentence of this book shows the problem facing the author: “JavaScript is a new technology that is rapidly changing.” Flanagan’s answer is to produce a book labeled beta edition for Netscape 2.0 and 3.0B6. (The preface does a reasonable job of justifying this approach, though without explaining how a beta edition can be “definitive.”) This creates a problem for the reviewer: by the time readers see the review, both JavaScript and the book will have moved on. My answer is to try to assess, based on this version, how good an edition current at the time this review appears is likely to be.
The 14 chapters are
An Overview of JavaScript
Lexical Structure
Variables and Data Types
Expressions and Operators
Statements
Objects and Arrays
Functions and Methods
Built-In Objects and Functions
Client-Side Program Structure
The Window Object
The JavaScript Object Hierarchy
LiveConnect: JavaScript and Java
JavaScript Security
Commonly Encountered Bugs in Navigator 2.0
This takes us only to page 180, the remaining 60 percent of the text being a JavaScript reference (and helping to justify the label “definitive”). This is mostly the sort of thing you would expect for any 1990s language but, as Flanagan points out with slight and forgivable exaggeration, “if you treat JavaScript as simply a new programming language, you’re missing the whole point” (p. 4). Chapter 9, in particular, will be an eye-opener for those raised on conventional languages.
I warmed immediately to the first four sections of chapter 1: “What JavaScript Is,” “What JavaScript Isn’t,” “What JavaScript Can Do,” and “What JavaScript Can’t Do.” These are areas that far too many authors of programming language books take for granted. Client-side JavaScript, embedded in HTML, runs on Web browsers; server-side JavaScript runs on Web servers. This beta edition deals almost entirely with the former, the latter being left until it is in a more settled state.
In general, I stayed warm as I read on. The least satisfactory chapters are 12 and 13, but that is the fault of the rapidly changing language, not of the author. I also noted in chapter 9 the various shifts that a JavaScript programmer has to resort to in order to cope with incompatibilities: as always, it is the language users (programmers and program users) who have to pay the cost of the lack of standardization. As I write, a JavaScript standard is mooted, but experience suggests that the result will, at best, alleviate the incompatibility problems, not remove them.
Flanagan writes well and clearly. I noted a few errors, fewer than might be expected in a confessed “draft,” and all of them either trivial or so obvious as not to confuse. I felt my usual irritation at an author describing a language as “untyped” and then going on to discuss its datatypes, but he only follows a long and dishonorable tradition; it always amazes me how such sloppy use of (natural) language is tolerated in our field. At least Flanagan explains what he means by “untyped”; too many authors do not.
So, how good is an edition current at the time this review appears likely to be? For client-side JavaScript, if it is in fact the first edition (not a beta edition), I expect it to be good enough to spend my money on. If you need server-side JavaScript, you will have to wait for an edition that deals with that, and though there is little direct evidence to go on, the indirect evidence suggests that Flanagan will not let you down.