1. Meet JavaScript and the runtime
BeginnerUnderstand where JavaScript runs, how to execute a script, and how to inspect output with developer tools.
Your first JavaScript program
JavaScript statements tell a runtime what actions to perform.
Browsers, engines, and Node.js
The language is shared, but host environments provide different APIs.
Console output and first errors
Console methods help you inspect data and investigate failures.
Module checkpoint: Run a script that prints your name, a number, and an array. Introduce a small typo, inspect the error, and then fix it.
2. Variables, values, and data types
BeginnerDeclare variables, identify primitive and reference values, and convert data deliberately.
Declare variables with let and const
Declarations define bindings; const prevents reassignment of the binding.
Primitive types and typeof
JavaScript has primitive values as well as objects.
Conversion, equality, and NaN
Explicit conversion and strict equality make data handling clearer.
Module checkpoint: Write a small script that converts a text input to a number, handles invalid numeric text, and logs the type and result of each conversion.
3. Operators and decisions
BeginnerBuild expressions and use branching to express program rules clearly.
Arithmetic and comparison operators
Operators combine values to calculate results or compare conditions.
Make decisions with if and switch
Conditional statements select which block of code runs.
Truthiness and default values
Truthiness controls conditions, while ?? and || have different fallback rules.
Module checkpoint: Create a grade calculator that validates the score range, uses if/else to assign a grade, and handles missing input separately from a score of zero.
4. Loops and iteration
BeginnerRepeat work using counter-based and condition-based loops, and iterate over collections safely.
Count with for loops
A for loop groups initialization, condition, and update in one place.
Repeat with while and do...while
while checks before each iteration; do...while checks after the body.
Iterate over arrays and object keys
for...of iterates values from an iterable; for...in enumerates property keys.
Module checkpoint: Write a program that sums an array of numbers, counts values above a threshold, and handles an empty array without errors.
5. Functions, scope, and closures
IntermediateCreate reusable functions, pass arguments, and understand how names and state behave across scopes.
Function declarations, expressions, and arrows
Functions package reusable behavior and can be passed as values.
Parameters, defaults, and rest arguments
Parameters define a function's inputs and can support defaults or variable-length argument lists.
Scope, callbacks, and closures
A closure retains access to variables from the lexical scope where a function was created.
Module checkpoint: Create a reusable calculator with separate functions for validation, calculation, and formatting. Then write a closure that keeps a private counter.
6. Arrays, objects, and data modeling
IntermediateStore collections and structured records, transform data, and use modern syntax to work with nested values.
Arrays and array methods
Arrays hold ordered values and provide methods for common transformations.
Objects and property access
Objects group related information in named properties.
Destructuring and spread syntax
Destructuring extracts values; spread syntax copies enumerable properties or expands iterables.
Module checkpoint: Given an array of product records, filter active products, transform their names for display, and calculate the total price. Use destructuring to make the code readable.
7. Strings, numbers, dates, and JSON
IntermediateManipulate text and numeric values, work with timestamps, and exchange structured data using JSON.
Strings and template literals
String methods and template literals make text processing clearer.
Numbers, Math, and precision
JavaScript's number type uses floating-point representation, which affects precision and rounding.
JSON and dates
JSON provides a text format for data exchange, while Date represents time values.
Module checkpoint: Build a small product summary that trims names, formats numeric prices consistently, and saves and reloads a record through JSON serialization.
8. The DOM and browser programming
IntermediateConnect JavaScript to HTML documents, locate elements, update the page, and create interface elements safely.
Select HTML elements
The DOM represents a web page as objects that JavaScript can inspect and update.
Update text, classes, and attributes
DOM properties and classList allow JavaScript to change page content and state.
Create and remove elements
DOM creation methods let a page render lists and update sections dynamically.
Module checkpoint: Create a page section that renders a list of lesson titles from an array, displays an empty-state message for no data, and uses textContent for all inserted titles.
9. Events, forms, and browser storage
IntermediateRespond to user actions, validate form data, and persist small amounts of browser-side state.
Events and event listeners
Events communicate interactions such as clicks, key presses, and submissions.
Form submission and validation
Forms should validate values, prevent unwanted navigation when needed, and report errors clearly.
Persist preferences with Web Storage
localStorage and sessionStorage store strings in the browser for simple client-side persistence.
Module checkpoint: Build a browser checklist with add, complete, and remove actions. Validate empty entries and save the list to localStorage, handling malformed or unavailable stored data.
10. Asynchronous JavaScript and networking
AdvancedUnderstand asynchronous work, compose promises, and fetch remote data without blocking the main execution flow.
Callbacks and promises
Promises represent work that may complete in the future.
Write asynchronous code with async and await
async and await let promise-based flows read like sequential code.
Fetch API and HTTP responses
fetch() performs network requests, but HTTP error status codes must be checked explicitly.
Module checkpoint: Create an async function that fetches JSON, checks HTTP status, validates the returned data shape, and displays a loading state plus a useful error message.
11. Classes, modules, and error handling
AdvancedOrganize code into reusable units, model behavior with classes when appropriate, and handle expected failures explicitly.
Classes and object-oriented design
Classes provide syntax for creating objects with shared behavior and prototype-based inheritance.
Organize code with ES modules
Modules separate code into files with explicit exports and imports.
Exceptions and error boundaries
Exceptions communicate failures that normal return values cannot conveniently represent.
Module checkpoint: Split a small calculator into modules, validate its inputs, and use a custom error or standard Error to report invalid operations.
12. Tooling, testing, and advanced patterns
AdvancedPractice data structures and functional patterns, use development tools and tests, and prepare a reliable application for delivery.
Map, Set, and collection choices
Map and Set handle common collection needs beyond arrays and plain objects.
Pure functions and functional patterns
Pure functions and immutable updates make behavior easier to test and reason about.
Testing, performance, and secure habits
Automated checks and measurement help prevent regressions and guide improvements.
Module checkpoint: Add tests for a pure calculation function, include empty and invalid input cases, run a linter if available, and review the program for unsafe DOM updates and unhandled failures.