Review of JavaScript: A Beginner's Guide, Second Edition
JavaScript: A Beginner's Guide, Second Edition is written by John Pollock and published by Osborne.
phpBB Smith rates this book 3.5 out of 5.
Hello, World
As part of a series of "beginner's guides," this book provides a very good introduction to the possibilities using JavaScript on a web page opens. Even intermediate or experienced programmers may find the extensive lists of object properties and methods useful. On the other hand, JavaScript: A Beginner's Guide does have a few flaws that may lead to confusion for some beginners.
Start the Ball Rolling...
The first two chapters are, as may be expected, an introduction to JavaScript and how to use it in general. Readers are advised in the first chapter to be familiar with using basic Hypertext Markup Language (HTML), text editors, the latest Netscape and Microsoft web browsers, and differences in JavaScript versions before continuing the book. The JavaScript versions are explained in the text, however, so even readers that didn't know there are different versions, as I did'nt when I picked this up, won't have a problem there. There are also enough basic HTML examples and explanations, both in chapter two and later chapters, that HTML novices should not have difficulties applying the lessons presented.
The next four chapters cover usage of things you're likely to find in any modern programming language: variables, functions, operators, conditional statements, and loops. These are all very well presented, as well as easy to use and understand. Each chapter is divided into smaller sections about the topics, and most sections have example projects for demonstrating and practicing one's skills with the code. These projects clearly show what the code should look like up to the end of chapter six.
Watch that Learning Curve
Later chapters, however, present the example projects in a more freeform manner. Readers are not given code they can simply type line by line, but rather presented instructions such as "have the script write a line of text." While this approach encourages creativity on the part of the reader, it can also give programming beginners a problem if they are not aware of common syntax errors they may accidentally make. Fortunately, example code for every project is provided as a free download from the publisher's website. The book never mentions this fact other than having a "Free Files Online Bonus" message on the front and back covers, though, so readers may easily miss these example files. The files from the website also contain extra examples not included in this edition of the book.
Chapter seven delves back into the world of HTML to explain what may be the feature of JavaScript most used by beginners - Event Handlers. All Event Handlers are at least described, with the most commonly used ones being explained in more depth than others. This chapter is a little misplaced in the order of the book, however, as you'll see later.
Objective: Objects
In the next several chapters, eight through twelve, JavaScript objects are explained in very good detail. There is a chapter for objects in general, of course, and it is followed by chapters devoted solely to the Document and Window objects. The fourth chapter in this series is devoted to arrays, which the book explains are actually another type of JavaScript object. Here, another misplaced chapter has appeared. The previous two chapters, dealing with Document and Window objects, mention that arrays are discussed later several times when describing the features of those objects. If the chapter on arrays had preceded these two chapters, then these chapters would have been much improved. With their currently repeated references to the later chapter, they can quickly cause some readers to lose interest.
The last object-based chapter covers three objects: Math, Number, and Date. They are not covered in as much depth as the more commonly used objects in other chapters, but the discussion of these is adequate for almost anything of which a beginner would need to be aware. The thirteenth chapter also touches on an object, the String object, while discussing the various things that can be done with string variables.
The next two chapters return to major integration of HTML in the topic, specifically in using JavaScript with forms and frames. The Event Handlers chapter would be right at home here, since it also deals heavily with HTML features useful with JavaScript. The forms chapter provides useful tips for using a Form object in data validation and navigation drop down boxes. Like the rest of the book, however, it only barely touches on the major drawbacks of these techniques, the worst of which being that they will not function if JavaScript is disabled in the user's browser. The frames chapter also deals mainly with navigation techniques, but also touches on the usefulness of using variables across multiple frames.
A Bug? Debug!
In the final chapter, some "advanced" features of JavaScript are briefly covered. These start with debugging, with an emphasis on using the Microsoft browser. The far superior and easier to use debugging capabilities of Netscape's browser offering aren't mentioned at all. The rest, namely regular expressions, cookies, security, and image manipulation, are covered quickly, but again adequately. The image manipulation consists mainly of preloading and rollovers, the latter of which would have fit into the Event Handlers chapter nicely.
The book wraps up with an appendix of answers to "Mastery Checks," brief quizzes found at the end of each chapter. The Mastery Checks are a useful reinforcement tool for the information presented, but are overly simple and sometimes even provide the answer to a question within the question itself. A brief, and not very complete, index follows, wrapping the book up at 550 pages.
While JavaScript: A Beginner's Guide, Second Edition is a good value for its price overall, and presents useful information that will help beginners improve their JavaScript skills, it could be organized in a more useful and natural way. The examples and skills developed will help readers improve the interactivity of web pages, but you'll also need a good dose of imagination to turn them into practical examples.
