Cover image

Eloquent JavaScript
4th edition (2024)

This is a book about JavaScript, programming, and the wonders of the digital. You can read it online here, or buy your own paperback copy (3rd edition).

Written by Marijn Haverbeke.

Licensed under a Creative Commons attribution-noncommercial license. All code in this book may also be considered licensed under an MIT license.

Illustrations by various artists: Cover by Péchane Sumi-e. Chapter illustrations by Madalina Tantareanu. Pixel art in Chapters 7 and 16 by Antonio Perdomo Pastor. Regular expression diagrams in Chapter 9 generated with by Jeff Avallone. Game concept for Chapter 16 by Thomas Palef.


  1. Introduction
  2. (Part 1: Language)

    Values, Types, and Operators
  3. Program Structure
  4. Functions
  5. Data Structures: Objects and Arrays
  6. Higher-order Functions
  7. The Secret Life of Objects
  8. Project: A Robot
  9. Bugs and Errors
  10. Regular Expressions
  11. Modules
  12. Asynchronous Programming
  13. Project: A Programming Language
  14. (Part 2: Browser)

    JavaScript and the Browser
  15. The Document Object Model
  16. Handling Events
  17. Project: A Platform Game
  18. Drawing on Canvas
  19. HTTP and Forms
  20. Project: A Pixel Art Editor
  21. (Part 3: Node)

  22. Project: Skill-Sharing Website