There are plenty of books that teach JavaScript from a basic introductory angle. The Pragmatic Guide to JavaScript is a bit different. It’s a lightweight guide (around 130 pages) for those of us who already know a programming language or two. Instead of covering boring stuff like variables and functions—let’s face it, they’re not all that different from language to language—it shows you some real-world use cases in convenient byte-size portions.
The book’s format is interesting. Each chapter is a two-page spread with the text on one side and code samples on the other. Each of the chapters deals with a single practical usage of JavaScript, such as:
- Dynamically selecting methods and properties
- Using the Module Pattern to prevent naming collisions
- Optional function arguments
- Dynamically styling content
- Preloading images
- Form validation and dynamic form fields
- AJAX, JSON, JSON-P and cross-domain AJAX
- An introduction to mashups
Another neat feature is the way it shows examples using straight JavaScript as well as with different frameworks.
Overall the book seems like a great way to dive right into JavaScript, providing you already have some scripting experience with another language. It was quite useful to me, as by grounding in JavaScript isn’t nearly as good as with PHP. I learned a few new tricks.