The JavaScript Way
Minimum price
Suggested price

The JavaScript Way

Master the language that powers the digital world

About the Book

From web sites and apps to servers, smartphones and connected objects, JavaScript is everywhere. It has evolved from a niche scripting tool crafted in a few days into a modern, multi-purpose language sitting on top of a rich ecosystem and a vibrant developer community. Some even consider JavaScript to be the most important technology in software development nowadays.

However, learning JavaScript properly is not that easy. Many resources are outdated and teach obsolete practices. Many others cover advanced topics that are of little interest to beginners and "switchers" coming from other languages and platforms.

Beginner-friendly yet comprehensive, standards-aligned, hands-on and easy to follow, this book will be a useful companion for anyone wishing to explore the many facets of JavaScript.

About the Author

Baptiste Pesquet
Baptiste Pesquet

I am a software engineer and teacher with 20+ years of experience in computer science.

I love to share my knowledge and experience through (hopefully) well-crafted educational resources.

I hope they'll help you in your learning journey!

About the Contributors

Emily Reese
Emily Reese

Teacher @ OpenClassrooms

Initial English translation and many good ideas.

Jessica Mautref
Jessica Mautref

Editor @ OpenClassrooms

Initial proofreading and many good ideas.

Reader Testimonials

Dmitri Grabov
Dmitri Grabov

Founder and JavaScript instructor at Constructor Labs

The best entry level JS book out there

Ahmed Alharbi
Ahmed Alharbi

Multidisciplinary freelance developer

There's literally no other book that helped me like yours did in my school, work and ultimately in my life and career, I’m literally writing apps now. Your way of saying things is just on point.

Sasha Argunov
Sasha Argunov

If you are searching for a solid understanding of the language with a lot of examples and exercises, that's the book for you. I was actually surprised by how good the book was. It's so far my favourite.

Table of Contents

  • Introduction
    • About this book
      • Who this book is for
      • Book structure
    • Welcome to programming
      • What’s in a program?
      • How do you create programs?
      • Learn to code
      • TL;DR
    • Introducing JavaScript
      • A brief history of JavaScript
      • JavaScript: an essential language
      • Version used in this book
      • TL;DR
    • Environment setup
      • Prerequisite: a modern browser
      • Solution 1: coding online
      • Solution 2: using a local development environment
      • TL;DR
  • Learn to code programs
    • 3, 2, 1… Code
      • Your first program
      • Values and types
      • Program structure
      • TL;DR
      • Coding time!
    • Play with variables
      • Variables
      • Expressions
      • Type conversions
      • User interactions
      • Variable naming
      • TL;DR
      • Coding time!
    • Add conditions
      • What’s a condition?
      • Alternative conditions
      • Add additional logic
      • Multiple choices
      • TL;DR
      • Coding time!
    • Repeat statements
      • Introduction
      • The while loop
      • The for loop
      • Common mistakes
      • Which loop structure should I use?
      • TL;DR
      • Coding time!
    • Write functions
      • Introduction: the role of functions
      • Discovering functions
      • Function contents
      • Anonymous functions
      • Guidelines for programming with functions
      • TL;DR
      • Coding time!
    • Create your first objects
      • Introduction
      • JavaScript and objects
      • Programming with objects
      • JavaScript predefined objects
      • TL;DR
      • Coding time!
    • Store data in arrays
      • Introduction to arrays
      • Manipulating arrays in JavaScript
      • Iterating over an array
      • Updating an array’s content
      • TL;DR
      • Coding time!
    • Work with strings
      • String recap
      • Obtaining string length
      • Converting string case
      • Comparing two strings
      • Strings as sets of characters
      • Turning a string into an array
      • Searching inside a string
      • Breaking a string into parts
      • TL;DR
      • Coding time!
    • Understand object-oriented programming
      • Context: a multiplayer RPG
      • JavaScript classes
      • Under the hood: objects and prototypes
      • Object-oriented programming
      • TL;DR
      • Coding time!
    • Discover functional programming
      • Context: a movie list
      • Program state
      • Pure functions
      • Array operations
      • Higher-order functions
      • JavaScript: a multi-paradigm language
      • TL;DR
      • Coding time!
    • Project: a social news program
      • Objective
      • Functional requirements
      • Technical requirements
      • Expected result
  • Create interactive web pages
    • What’s a web page?
      • Internet and the Web
      • The languages of the Web
      • Developing web pages
      • TL;DR
      • Coding time!
    • Discover the DOM
      • Introduction to the DOM
      • Web page structure
      • Get started with the DOM in JavaScript
      • TL;DR
      • Coding time!
    • Traverse the DOM
      • Sample web page
      • Selecting elements
      • Obtaining information about elements
      • TL;DR
      • Coding time!
    • Modify page structure
      • Modify an existing element
      • Adding a new element
      • Variations on adding elements
      • Replacing or removing nodes
      • Styling elements
      • DOM manipulations and performance
      • TL;DR
      • Coding time!
    • React to events
      • Introduction to events
      • The event family
      • Reacting to common events
      • Go farther with events
      • TL;DR
      • Coding time!
    • Manipulate forms
      • JavaScript and forms
      • Form fields
      • Forms as DOM elements
      • Form validation
      • TL;DR
      • Coding time!
    • Animate elements
      • Repeat an action at regular intervals
      • Trigger an action after a delay
      • Animate page elements
      • Choosing the right animation technique
      • TL;DR
      • Coding time!
    • Project: a social news web page
      • Objective
      • Functional requirements
      • Technical requirements
      • Starter code
      • Expected result
  • Build web applications
    • Web development 101
      • How the Web works
      • HTTP, the web protocol
      • From web sites to web apps
      • JSON, a data format for the web
      • TL;DR
    • Query a web server
      • Creating asynchronous HTTP requests in JavaScript
      • Handling JSON data
      • TL;DR
      • Coding time!
    • Use web APIs
      • Introducing web APIs
      • Consuming a web API
      • Web APIs and authentication
      • TL;DR
      • Coding time!
    • Send data to a web server
      • Sending data: the basics
      • Sending form data
      • Sending JSON data
      • TL;DR
      • Coding time!
    • Discover Node.js
      • Introducing Node.js
      • Node.js modules
      • Node.js packages
      • Package management with npm or yarn
      • TL;DR
      • Coding time!
    • Create a web server
      • Using a framework
      • Responding to requests
      • Creating an API
      • Exposing data
      • Accepting data
      • Publishing web pages
      • TL;DR
      • Coding time!
    • Project: a social news web app
      • Objective
      • Functional requirements
      • Technical requirements
      • Expected result
  • Conclusion
    • Summary and perspectives
      • Key takeaways
      • The road ahead
  • Appendices
    • Style guide
      • Naming
      • Code formatting
      • Code quality
    • Acknowledgments

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub