Eloquent JavaScript

A Modern Introduction to Programming
by Marijn Haverbeke

January 2011, 224 pp.
ISBN: 978-1-59327-282-1

"A concise and balanced mix of principles and pragmatics. I loved the tutorial-style game-like program development. This book rekindled my earliest joys of programming. Plus, JavaScript!"
—Brendan Eich, creator of JavaScript

JavaScript is at the heart of almost every modern Web application, whether it's Google Apps, Twitter, or the newest browser-based game. Though it's simple for beginners to pick up and play with, JavaScript is not a toy—it's a flexible and complex language that can be used to build full-scale applications.

Eloquent JavaScript dives into this flourishing language and teaches you to write code that's beautiful and effective. By immersing you in example code and encouraging experimentation right from the start, the author quickly gives you the tools you need to build your own programs. As you follow along with examples like an artificial life simulation and a version of the classic game Sokoban, you'll learn to:

  • Understand the essential elements of programming: syntax, control, and data
  • Use object-oriented and functional programming techniques to organize and clarify your programs
  • Script the browser and make basic Web applications
  • Work with tools like regular expressions and XMLHttpRequest objects

And since programming is an art that's best learned by doing, all example code is available online in an interactive sandbox for you to experiment with. With Eloquent JavaScript as your guide, you can tweak, expand, and modify the author's code, or throw it away and build your own creations from scratch. Before you know it, you'll be fluent in the language of the Web.

About the Author

Marijn Haverbeke is a programming language enthusiast and polyglot. He's worked his way from trivial BASIC games on the Commodore, through a C++ phase, to the present where he mostly hacks on database systems and web APIs in dynamic languages. He created and maintains several popular open source projects.

Table of Contents


Chapter 1: Basic JavaScript: Values, Variables, and Control Flow
Chapter 2: Functions
Chapter 3: Data Structures: Objects and Arrays
Chapter 4: Error Handling
Chapter 5: Functional Programming
Chapter 6: Object-Oriented Programming
Chapter 7: Modularity
Chapter 8: Regular Expressions
Chapter 9: Web programming: A crash course
Chapter 10: The Document Object Model
Chapter 11: Browser Events
Chapter 12: HTTP requests

View the detailed Table of Contents (PDF)

View the Index (PDF)



"A concise and balanced mix of principles and pragmatics. I loved the tutorial-style game-like program development. This book rekindled my earliest joys of programming. Plus, JavaScript!"
—Brendan Eich, creator of JavaScript

"Marijn Haverbeke is a software philosopher and all-round genius. He also has a terrific sense of humor and writes both prose and code in a friendly and un-intimidating fashion. In common with the very best teachers he dispenses his wisdom with disarming simplicity. I became a better architect, author, mentor and developer because of this book. It deserves to share shelf space with Flannagan and Crockford."
—Angus Croll, Twitter Developer (Read More)

"If you decide to purchase only one JavaScript book, that book should be Marijn Haverbeke's Eloquent JavaScript."
—Joey deVilla, Global Nerdy (Read More)

"One of the greatest texts for not just learning JavaScript, but for learning modern programming in general as told through JavaScript. This is the book I give out when people ask me how to learn proper JavaScript."
—Chris Williams, organizer of JSConf US

"It's a fantastic book."
—Design Shack (Read More)

"Eloquent JavaScript is one of the best JavaScript books I've read."
—Rey Bango, jQuery Team member and Client-Web Community Program Manager at Microsoft (Read More)

"This book is a really good guide to Javascript; but even more than that, this book is a great guide to programming."
—Ben Nadel, Chief Software Engineer at Epicenter Consulting (Read More)

"Eloquent JavaScript does a good job of detailing the fundamentals and explaining concepts like the stack and the environment. This attention to detail is what sets the book apart from other JavaScript books."
—Designorati (Read More)

"If you're new to JavaScript, the first thing I'd recommend you do is visit Eloquent JavaScript and check out Marijn Haverbeke's introduction to the language."
—CNET UK (Read More)

"Eloquent JavaScript is a great book if you're learning JavaScript."
—Craig Buckler, Optimalworks Ltd. (Read More)

"Eloquent JavaScript is a good book, suitable for those without experience in JavaScript and even those without programming experience."
—Nicholas Zakas, author of High Performance JavaScript (Read More)

"A JavaScript book and programming primer that stands apart from the rest."
—Webmaster-Source (Read More)

"By treating JavaScript as a language in it's own right, the author has produced a solid guide to learning a language you might think you already knew."
—YYZtech (Read More)

"This book takes a different approach to teaching JavaScript to beginners and by doing so manages to cover a large portion of the language very thoroughly in a relatively small book."
—About.com JavaScript (Read More)

"Not only did [Eloquent JavaScript] get into the nitty gritty of JavaScript, techniques, and patterns, but it also did it in a light hearted and often times hilarious way."
—Web Dev .NET (Read More)

"One of the best programming books I've ever read."
—vcoportal (Read More)

"Eloquent JavaScript is a good introduction to the language."
—fish.moth (Read More)

"If you choose to start your JavaScript journey with this book, it can quickly teach you a lot of technical information."
—Michael J. Ross, and Slashdot contributor (Read More)



(show updates)(top)