The JavaScript Way
Minimum price
Suggested price

The JavaScript Way

A gentle introduction to an essential language

About the Book

Love it or hate it, JavaScript is avidly eating the world of software development. 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.

This book aims to be a useful companion for anyone wishing to (re)discover the many facets of JavaScript. Numerous brain cycles were spent to make it:

  • Beginner-friendly yet comprehensive. From the very basics of programming up to full-stack web development, a lot of topics are covered in a simple and accessible way. No prior knowledge needed!
  • Standards-aligned. This book is entirely written using the recent ES2015 syntax, giving you future-proof knowledge. From start to finish, it enforces good programming habits, embraces the ubiquitous JavaScript tools ESLint and Prettier and closely follows the popular AirBnb Style Guide.
  • Hands-on. No real learning happens without practicing! Each chapter is accompanied by a series of exercises to put your newly acquired skills into action. A three-part project will guide you in the creation of a social news web application (see it in action).
  • Easy to follow. Code along directly in your browser or build yourself a great JavaScript development environment.

About the Author

Baptiste Pesquet
Baptiste Pesquet

Hello! I'm a software engineer and a teacher in Computer Science and Artificial Intelligence.

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

The Leanpub 45-day 100% Happiness Guarantee

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

See full terms

Do Well. Do Good.

Authors have earned$10,795,682writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

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), EPUB (for phones and tablets) and MOBI (for 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, EPUB and/or MOBI files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub