The Complete JavaScript Learning Guide
JavaScript is a programming language standardized as ECMAScript. It is widely used to make web pages interactive and also runs on servers and in other environments.
How JavaScript works
A JavaScript engine runs your instructions. The language uses values and objects, and it can respond to events such as a button click or a network reply.
What you will learn
You will begin with basic values and decisions, then learn functions, objects, collections, browser interaction, asynchronous work, and project structure.
How to use this guide
- Start with Chapter 1 and move through the chapters in order. New ideas build on the earlier ones.
- Type each example yourself, make a small change, and predict what will happen before running it.
- When a chapter is ready, its lesson will appear at the chapter link. These pages are currently blank lesson starters.
A step-by-step learning path
- Chapters 1-7: Learn the language basics. Run JavaScript, work with values and variables, receive input, make decisions, repeat actions, and write functions.
- Chapters 8-12: Work with data and objects. Use arrays and other collections, process text, understand object references, and model information with objects and classes.
- Chapters 13-18: Build organized applications. Learn scope, modules, packages, standard APIs, files, errors, debugging, and testing.
- Chapters 19-24: Build for real situations. Explore algorithms, asynchronous work, reliability and performance, developer tools, and guided projects.
JavaScript ideas you will meet early
- Runtime: the environment that runs your code. A browser provides web-page features; Node.js runs JavaScript programs outside a browser.
- Variable: a name for a value. Use
constby default when you will not reassign the name, andletwhen you will. - Array: an ordered collection of values. Its first position has index
0. - Event: something the program can respond to, such as a click or a completed network request.
Your first JavaScript program
Create a file named hello.js with this instruction:
console.log("Hello, world!");
console.log writes a message to the runtime's console. The quoted text is a string, and the semicolon marks the end of the instruction. To run this file with Node.js, open a terminal in its folder and enter:
node hello.js
To run JavaScript in a web page, the page must load a script file; the browser console is also a useful place to try short examples. Node.js is one option for running the first file above without building a web page.
A simple way to study
- Practice one expression or function at a time in the environment where you plan to use it.
- Change one part of an example, predict the output, and then run it to check your prediction.
- Notice whether an example is for a browser or Node.js; they provide different built-in features.
- Read errors from the first line and use small tests to check what a function returns.
First file: save your first program as hello.js. A typical way to run it is node hello.js with Node.js installed.
Course chapters
Follow the 24 chapters in order, or choose a topic to revisit. Each chapter opens its own lesson page.
- What JavaScript is and how a program runs
- Your first program
- Values, types, and variables
- Input and output
- Expressions and operators
- Decisions and loops
- Functions and program structure
- Collections: arrays, lists, and slices
- Strings and text
- References, pointers, and memory
- Memory and resource management
- User-defined types and data modeling
- Scope, lifetime, and visibility
- Modules, imports, and declarations
- Multi-file programs, packages, and libraries
- The standard library and ecosystem
- File input and output
- Errors, debugging, and testing
- Data structures and algorithms
- Advanced language topics
- Safety, portability, and performance
- Build systems and professional workflow
- A project ladder
- Further study checklist