Part 3. Prototype in Depth
Part 2 of this book provided a detailed tour of the Scriptaculous library, and part 3 performs a similar function for Prototype. Prototype is a much lower-level library than Scriptaculous, and is concerned primarily with improving the experience of writing JavaScript. Hence, three of the four chapters in this part of the book are concerned with JavaScript as a language. Only the final chapter looks at Prototype’s features for working specifically with web browsers.
Throughout the language chapters, we begin by discussing the features of unadorned JavaScript, and then relate these to the improvements provided by Prototype. This part of the book can be read, then, as a primer on the JavaScript language, as well as a discussion of Prototype. While it’s possible to get by as a JavaScript coder without knowing all the details of the language, the topics that we cover in this part of the book will improve your coding, whether or not you end up using Prototype and Scriptaculous.
Chapter 8 deals with JavaScript objects and the mechanisms that Prototype provides to enable you to develop simple object hierarchies. Chapter 9 looks at JavaScript Function objects, and in particular at Prototype’s support for closures, one of the darkest and most mysterious corners of JavaScript, and one of the more powerful! Chapter 10 discusses JavaScript Arrays, and shows you how Prototype provides an entirely new way of working with Arrays.