Eloquent JavaScript, 4th Edition

Start building beautiful web applications in JavaScript with the bestselling introduction to the language, updated with new features, fresh exercises, and fun projects.

JavaScript, the programming language that allows us to add programs to web pages, lies at the heart of almost every modern web application, from social media sites to browser-based games. Just about every device can run it, making it a great choice for writing universally useful code.

The fourth edition of this classic textbook takes you on a journey through the language of the web, starting from its basic elements and building up to engaging, complete programs. The author’s personal experiences from years of maintaining popular open source projects enliven the text with practical insights and examples. 

This edition of Eloquent JavaScript updates the book to describe the 2024 version of JavaScript, and shifts the attention given to some topics to better reflect current development practices.

The text takes a practical approach to teaching, rooting theory in plenty of motivating examples. The first half of the book describes the fundamentals of the language, whereas the second half shows how to apply it in two programming environments: the web browser and Node.js. Five project chapters show how to build bigger programs, working through these projects in a piecemeal, conversational way. They include a pathfinding robot, a small programming language, a platform game, a pixel drawing program, and a simple dynamic website.

Exercises provided at the end of most chapters will challenge you to creatively apply the concepts and techniques introduced. The book’s companion website provides an interactive environment for working on these exercises and playing with the example programs.

Whether you’re looking to learn JavaScript or to deepen your programming skills, you’ll find this book full of stimulating material.

Updated to ECMAScript 2024
Introduction

Part I: Language
Chapter 1: Values, Types, and Operators 
Chapter 2: Program Structure 
Chapter 3: Functions 
Chapter 4: Data Structures: Objects and Arrays 
Chapter 5: Higher-Order Functions 
Chapter 6: The Secret Life of Objects 
Chapter 7: Project: A Robot 
Chapter 8: Bugs and Errors 
Chapter 9: Regular Expressions 
Chapter 10: Modules 
Chapter 11: Asynchronous Programming 
Chapter 12: Project: A Programming Language 

Part II: Browser
Chapter 13: JavaScript and the Browser 
Chapter 14: The Document Object Model 
Chapter 15: Handling Events 
Chapter 16: Project: A Platform Game 
Chapter 17: Drawing on Canvas 
Chapter 18: HTTP and Forms 
Chapter 19: Project: A Pixel Art Editor 

Part III: Node
Chapter 20: Node.js 
Chapter 21: Project: Skill-Sharing Website 
Chapter 22: JavaScript and Performance

Exercise Hints 
Index
Marijn Haverbeke is a programming language enthusiast and polyglot. He’s worked on a wide range of software systems, from databases to compilers to editors. He runs a small business around his open source projects.

About

Start building beautiful web applications in JavaScript with the bestselling introduction to the language, updated with new features, fresh exercises, and fun projects.

JavaScript, the programming language that allows us to add programs to web pages, lies at the heart of almost every modern web application, from social media sites to browser-based games. Just about every device can run it, making it a great choice for writing universally useful code.

The fourth edition of this classic textbook takes you on a journey through the language of the web, starting from its basic elements and building up to engaging, complete programs. The author’s personal experiences from years of maintaining popular open source projects enliven the text with practical insights and examples. 

This edition of Eloquent JavaScript updates the book to describe the 2024 version of JavaScript, and shifts the attention given to some topics to better reflect current development practices.

The text takes a practical approach to teaching, rooting theory in plenty of motivating examples. The first half of the book describes the fundamentals of the language, whereas the second half shows how to apply it in two programming environments: the web browser and Node.js. Five project chapters show how to build bigger programs, working through these projects in a piecemeal, conversational way. They include a pathfinding robot, a small programming language, a platform game, a pixel drawing program, and a simple dynamic website.

Exercises provided at the end of most chapters will challenge you to creatively apply the concepts and techniques introduced. The book’s companion website provides an interactive environment for working on these exercises and playing with the example programs.

Whether you’re looking to learn JavaScript or to deepen your programming skills, you’ll find this book full of stimulating material.

Updated to ECMAScript 2024

Table of Contents

Introduction

Part I: Language
Chapter 1: Values, Types, and Operators 
Chapter 2: Program Structure 
Chapter 3: Functions 
Chapter 4: Data Structures: Objects and Arrays 
Chapter 5: Higher-Order Functions 
Chapter 6: The Secret Life of Objects 
Chapter 7: Project: A Robot 
Chapter 8: Bugs and Errors 
Chapter 9: Regular Expressions 
Chapter 10: Modules 
Chapter 11: Asynchronous Programming 
Chapter 12: Project: A Programming Language 

Part II: Browser
Chapter 13: JavaScript and the Browser 
Chapter 14: The Document Object Model 
Chapter 15: Handling Events 
Chapter 16: Project: A Platform Game 
Chapter 17: Drawing on Canvas 
Chapter 18: HTTP and Forms 
Chapter 19: Project: A Pixel Art Editor 

Part III: Node
Chapter 20: Node.js 
Chapter 21: Project: Skill-Sharing Website 
Chapter 22: JavaScript and Performance

Exercise Hints 
Index

Author

Marijn Haverbeke is a programming language enthusiast and polyglot. He’s worked on a wide range of software systems, from databases to compilers to editors. He runs a small business around his open source projects.