Learning JavaScript

I recently became the maintainer for a site that uses a bit of JavaScript. Surprisingly, I have no previous experience writing or maintaining anything in JavaScript, so I needed to get up to speed, if only to know what is going on. To help me out, I picked up a copy of Shelley Powers’ new book, Learning JavaScript.

I am familiar with Shelley Powers’ work, having read Unix Power Tools, a book that holds a special place on my shelf for its usefulness and depth. She is obviously someone who knows what she is doing.

This book states in the preface that

Readers of this book should be familiar with web page technology, including Cascading Style Sheets (CSS) and HTML/XHTML. Previous programming experience isn’t required, though some sections may require extra review if you have no previous exposure to programming.

That sums up the only negative thing I might be tempted to say about the book. Usually, O’Reilly’s “Learning” series books are excellent resources for complete newcomers and are the sort of books that I might point a novice toward. While this book is designed for the JavaScript novice, it is not the best resource for a programming/web creation novice. If you can’t follow or understand the following quoted sentences, this book isn’t for you. If you can, this book does an excellent job of covering the basics of JavaScript in depth and may end up being the only text you need on the topic.

JavaScript has just three primitive data types: string, numeric, and boolean. Each is differentiated from the others by the type of value it contains: string, numeric, and boolean, respectively.

My first exposure to programming was in 1981, using BASIC on a Radio Shack TRS-80 Color Computer. Over the years, I have studied (and often forgotten, but can certainly read a bit and understand the concepts of) LISP, C, Bash scripting, Perl, Python, and more. Lately I have spent more time using PHP and enjoying it, since that is the language of things like WordPress, Drupal, vBulletin and other commonly used CMS and interactive web site software. The two sentences quoted above seem perfectly clear to me, but I can imagine what they must seem like to someone with no experience with programming languages. So, now you have been warned. Let’s get to the good stuff for those who understand the jargon.

This book is clear, with enough detail to help you understand what is happening without bogging you down in the minutiae. The reader is expected to see how and why each facet of the language would be useful, so the examples given are simple and seem to be designed to help her get the feel for usage without pretending to be a cookbook of programming recipes, although some seem quite useful as they are such as Chapter 6’s code for browser detection, which allows you to modify content and/or how it is displayed based on the web browser being used to view your site.

The text covers everything you are likely to need while using JavaScript, and more importantly for me, most everything a person is likely to stumble across when reading existing code. You get a solid introduction to data types and variables, operators, statements, objects, and functions. This is built upon with chapters on debugging and cross-browser compatibility. This new second edition (just released earlier in 2009) has several updates and changes from the previous version including a wonderful comparison of the benefits of generating and processing XML data using Ajax versus using JSON.

If you are considering using JavaScript on a website that includes the dynamic creation of web pages, or if you have inherited one that you are now responsible for maintaining, this book would be a good resource to help you start to understand one of the more common languages used for doing so. This is especially true if you have any prior experience with any other programming language. If you want a cookbook, scripted-style, “do this, now do that” sort of beginner’s guide to making a site that holds your hand through the whole process, this is not the book you want.

2 thoughts on “Learning JavaScript

  1. Very nice, but this is just the very beggining. If you plan to use JS to professional web development, its better use a framework that is mature and implements the best practices. In our company, and largely adopted around the world is jQuery at http://www.jquery.com. There are others, like extJS (but is more to JS UI) or prototype, but jQuery is for the core of JS things and its damn fast. Take a look, you will not regret! Cheers!

  2. Thank you. I know jQuery is now included in the base install of Drupal, which I use often. In fact, that was part of why I wanted to learn more. I appreciate the encouragement!

Comments are closed.