≡ Menu

0411 | JavaScript: The Missing Manual | David Sawyer McFarland

0411 | JavaScript: The Missing Manual | David Sawyer McFarland

Context: Another book read on the bus into and out of Cambridge.

Long, long ago, in a country far away, I attempted to teach myself JavaScript. I wasn’t really sure why I was doing it and that’s probably why I never finished the book. It may also be because it was written the way most computer tutorial books are written: badly.

I’m a teacher and that means I thing or two about how to get people to learn new skills. Many’s the time I’ve wanted to grab an author of a computer book by the mouse balls and smash them in the face with a keyboard. I mean, these people are supposed to be good at logic, right? If so, why does their writing seem so completely illogical. Websites written to “help” you do technical stuff are pretty much the same. Usually, these begin something like this; “This book/website/blog post is written for absolute beginners…” That’s the point at which you should simply turn away and cry. I usually make it to, oooh, about the third paragraph. By that point, I can’t see any logical connection between the points the writer is making. I’m lost. I give up.

But McFarland’s intro to JavaScript, is exactly the kind of book that bucks this trend and that’s why I liked it… a lot.

Not only does he write in a simple and engaging style, his writing actually makes sense. There wasn’t a single point in this 500+ page book where I felt I’d lost the plot. I followed it the entire way through. That in itself would be enough, but there’s more. He doesn’t have you build some completely meaningless website or project as  you go. This really irritates me because I have no desire to create an animated rock or a site that processes sales for a sports company. In case you thought I made those up, they were examples in other books I also looked at.

Instead, he takes you through simple examples and tutorials which are designed specifically for the task you are applying them to. What I really liked about the tutorials was that at each stage, he explains why you have to do what you’re being asked to do and reminds you of earlier sections in the book where these aspects were covered. In fact, the entire book is filled with cross-referencing which means that if on page 482 you have find yourself a victim of your own humanity and can’t remember what was discussed on page 145, he’ll remind you of it. This is just one example of the way McFarland shows that he has a good understanding of who he’s writing for.

And he’s comprehensive. There’s plenty of Ajax in here along with regular expressions, JSON and JQuery. In fact, there’s so much JQuery that the new edition is called JavaScript & JQuery. If you already know HTML and want to take it further, this is an excellent resource to do that with. I’d just recommend you pick up an edition more recent than the 2008 one I was working with.


By itself, HTML doesn’t have any smarts: it can’t do math, it can’t figure out if someone has correctly filled out a form, and it can’t make decisions based on how a Web visitor interacts with it.


The function’s name is printToday. It has just two lines of JavaScript code that retrieve the current date, convert the date to a format we can understand (that’s the toDateString() part), and then print the results to the page using our old friend the document.write() command. Don’t worry about how all of the date stuff works – you’ll find out in the next chapter.

Programmers usually put their functions at the beginning of a script, which sets up the various functions that the rest of the script will use later. Remember that a function doesn’t run when it’s first created – it’s like telling your assistant how to get to the pizza place without actually sending him there. The JavaScript code is merely stored in the browser’s memory, waiting to be run later, when you need it.


0411 | JavaScript: The Missing Manual | McFarland | 71% | Very Good

Key: Legacy | Plot / toPic | Characterisation / faCts | Readability | Achievement | Style Read more about how I come up with my ratings

0 comments… add one

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.