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
whileloop - The
forloop - 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