Eloquent JavaScript: A Modern Introduction to Programming

Front Cover
No Starch Press, 2011 - Computers - 224 pages

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.

 

Contents

Introduction
1
Basic JavaScript Values Variables and Control Flow
9
Functions
29
Data Structures Objects and Arrays
41
Error Handling
63
Functional Programming
71
ObjectOriented Programming
93
Modularity
129
Regular Expressions
139
Web Programming A Crash Course
151
The Document Object Model
163
Browser Events
173
HTTP requests
189
Index
197
Copyright

Common terms and phrases

About the author (2011)

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.

Bibliographic information