Javascript is hot.
In the past few years, its popularity has risen quickly, driven by a spreading interest in rich web applications. Lately, the rise of the server side framework Node.js has boosted Javascript's appeal even more.[1] For these reasons, and in the interests of becoming a "full stack"[2] web developer, I investigated multiple resources for learning the language.
I happened upon the Eloquent Javascript[3] website about a year ago. Although it was not quite the quick Javascript tutorial for which I was initially searching, I found that it was something different and in some ways much better.
The book since published is not your typical Javascript book.
Others have a utilitarian approach. An excellent O'Reilly book that I am also using[4] delves into much more detail about the language itself. Language components are presented one by one. An explanation of the syntax is given, then examples are presented. After that, exercises are given to help test the reader's knowledge, then on to the the next topic. This method is pretty standard. It is also effective and thorough (as far as I can tell).
In stark contrast, "Eloquent Javascript" (EJ) does not merely provide you a checklist of things to learn but rather paints a panorama of the possibilities that programming provides. Javascript is merely the tool used to introduce these to the reader. The subtitle, "A Modern Introduction to Programming," clearly states its intentions. This sample, from the introduction, provides a taste:
> In the beginning, at the birth of computing, there were no programming languages. Programs looked something like this:
> 00110001 00000000 00000000
> 00110001 00000001 00000001
> 00110011 00000001 00000010
> etc.
Although EJ does not follow a stepwise evolution of programming from here, it makes sure to lay the foundation for everything taught along the way.
The pace is actually quite fast. From the binary code displayed in the introduction, the book progresses towards very modern, and possibly difficult, concepts. It is something more suited for weeks of study than for several afternoons' reading. In Chapter 1, the reader is introduced to the basics of data types, variables, and program control structures like loops and assignments. By Chapter 5, the reader is being asked to parse text files using map/reduce functions. It's quite a progression, but logical in its execution.
EJ doesn't so much teach you how to _program in Javascript_ as much as it teaches you _how to program_ using Javascript. While doing so, it makes the reader proficient in the use of Javascript itself.
In the latter chapters, the book finally diverts to the topic of programming for the web. The quality of information in those chapters makes it well worth the wait.
I've found that many other resources (meaning books and/or websites) take for granted the basics that comprise web development. I suspect it is because the authors of those works are unfamiliar with the basics themselves. It is far too easy to get an even moderately complex system up and running without a full understanding of how everything works underneath. However, I feel that many details that are taken for granted deserve a more thorough discussion.
In EJ, the author gives programming for the web the same treatment he did programming in the abstract. He lays a foundation covering the fundamentals and then builds upon it, layer by layer. Chapter 9 begins with a definition and example of one simple and very basic HTTP request. From there, he continues on through client side browser manipulation and DOM hacking and then finishes up with a discussion of other types of HTTP requests (e.g. Ajax, etc.) and the HTTP protocol in general.
For me, this is the meat of the book. These three short chapters that contain a concise summary I have been unable to find anywhere else.
Separate from its utility, this book is also a pleasure to read.
The prose is witty and informative without getting in the way. The projects are practical but also fun in their whimsical nature. From Chapter 3 (Data Structure):
> Consider the following situation: Your crazy Aunt Emily, who is rumored
> to have more than 50 cats living with her (you never managed to count
> them), regularly sends you emails to keep you up-to-date on her exploits.
> They usually look like this:
You then spend the rest of the chapter writing programs to decipher Aunt Emily's letters. A later chapter on object-oriented programming has you constructing a virtual terrarium. Both sets of assignments are to the point; both are also fun.
The book is well edited. There are no typos that I have noticed so far, though I seem to find them quite easily in other books I read. The typefaces used are attractive and easy to read. Physically, the book is bound well and is sturdy. The paper is of relatively heavy weight, making it a pleasure to leaf through and useful for note-taking, if the reader is so inclined.
This book is highly functional, just like the material it contains.
Prior to this writing, I had already recommended this author's work to several friends as an excellent introduction to programming. (Full disclosure: This review was written against a free copy of the physical book sent by the publisher. At the time, I had already used and read the online versions, favorably mentioning them online.)
I also highly recommend the book to any programmer looking for a fun and insightful introduction to Javascript and web programming.
[1][...]
[2] By "Full Stack," I mean the ability to program everything from the server side scripting to the client side user interface (and everything in between). As of this writing, Javascript is a necessary portion of this stack.
[3] [...]
[4]"Learning Javascript" by Shelley Powers