Skip to content
iamnoobs

Beginner to advanced · 12 modules · 36 lessons

Learn JavaScript: Beginner to Advanced

Learn modern JavaScript from the basics to functions, data structures, browser programming, asynchronous code, modules, testing, and application design through short lessons, guided examples, quests, and a capstone.

Who this is for: Beginners and developers who want to build interactive websites, browser tools, or JavaScript applications and understand modern language features.

Prerequisites: No prior JavaScript experience is needed. Examples use modern JavaScript (ES2022-style syntax) and browser or Node.js concepts; code examples are explanatory and are not compiled or executed on this website.

Meet JavaScript and the runtime

Your first JavaScript program

JavaScript statements tell a runtime what actions to perform.

JavaScript is a programming language used in web browsers and in server-side environments such as Node.js. A browser can run JavaScript embedded in or linked from an HTML page; Node.js can execute a .js file from a terminal.

JavaScript is dynamically typed, so variables do not require type declarations. The runtime evaluates expressions and executes statements; syntax errors prevent the affected script from being parsed correctly.

Guided example

Read through this example; code examples are for learning and are not executed on this site.

console.log('Hello, JavaScript!');
const language = 'JavaScript';
console.log(`Welcome to ${language}`);

Relevance quest · +10 XP

Which statement writes a message to the console?

Choose your answer

Mark this lesson complete when you are ready.

Module checkpoint: Meet JavaScript and the runtime

Run a script that prints your name, a number, and an array. Introduce a small typo, inspect the error, and then fix it.

After this module, you can:

  • Explain the role of a JavaScript engine and runtime.
  • Run a script in a browser or Node.js environment.
  • Use console output to inspect values and diagnose simple mistakes.

Full curriculum

What you will learn

1. Meet JavaScript and the runtime

Beginner

Understand where JavaScript runs, how to execute a script, and how to inspect output with developer tools.

  1. Your first JavaScript program

    JavaScript statements tell a runtime what actions to perform.

  2. Browsers, engines, and Node.js

    The language is shared, but host environments provide different APIs.

  3. 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

Beginner

Declare variables, identify primitive and reference values, and convert data deliberately.

  1. Declare variables with let and const

    Declarations define bindings; const prevents reassignment of the binding.

  2. Primitive types and typeof

    JavaScript has primitive values as well as objects.

  3. 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

Beginner

Build expressions and use branching to express program rules clearly.

  1. Arithmetic and comparison operators

    Operators combine values to calculate results or compare conditions.

  2. Make decisions with if and switch

    Conditional statements select which block of code runs.

  3. 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

Beginner

Repeat work using counter-based and condition-based loops, and iterate over collections safely.

  1. Count with for loops

    A for loop groups initialization, condition, and update in one place.

  2. Repeat with while and do...while

    while checks before each iteration; do...while checks after the body.

  3. 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

Intermediate

Create reusable functions, pass arguments, and understand how names and state behave across scopes.

  1. Function declarations, expressions, and arrows

    Functions package reusable behavior and can be passed as values.

  2. Parameters, defaults, and rest arguments

    Parameters define a function's inputs and can support defaults or variable-length argument lists.

  3. 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

Intermediate

Store collections and structured records, transform data, and use modern syntax to work with nested values.

  1. Arrays and array methods

    Arrays hold ordered values and provide methods for common transformations.

  2. Objects and property access

    Objects group related information in named properties.

  3. 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

Intermediate

Manipulate text and numeric values, work with timestamps, and exchange structured data using JSON.

  1. Strings and template literals

    String methods and template literals make text processing clearer.

  2. Numbers, Math, and precision

    JavaScript's number type uses floating-point representation, which affects precision and rounding.

  3. 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

Intermediate

Connect JavaScript to HTML documents, locate elements, update the page, and create interface elements safely.

  1. Select HTML elements

    The DOM represents a web page as objects that JavaScript can inspect and update.

  2. Update text, classes, and attributes

    DOM properties and classList allow JavaScript to change page content and state.

  3. 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

Intermediate

Respond to user actions, validate form data, and persist small amounts of browser-side state.

  1. Events and event listeners

    Events communicate interactions such as clicks, key presses, and submissions.

  2. Form submission and validation

    Forms should validate values, prevent unwanted navigation when needed, and report errors clearly.

  3. 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

Advanced

Understand asynchronous work, compose promises, and fetch remote data without blocking the main execution flow.

  1. Callbacks and promises

    Promises represent work that may complete in the future.

  2. Write asynchronous code with async and await

    async and await let promise-based flows read like sequential code.

  3. 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

Advanced

Organize code into reusable units, model behavior with classes when appropriate, and handle expected failures explicitly.

  1. Classes and object-oriented design

    Classes provide syntax for creating objects with shared behavior and prototype-based inheritance.

  2. Organize code with ES modules

    Modules separate code into files with explicit exports and imports.

  3. 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

Advanced

Practice data structures and functional patterns, use development tools and tests, and prepare a reliable application for delivery.

  1. Map, Set, and collection choices

    Map and Set handle common collection needs beyond arrays and plain objects.

  2. Pure functions and functional patterns

    Pure functions and immutable updates make behavior easier to test and reason about.

  3. 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.

Put it together

JavaScript capstone: Personal study planner

Build a browser-based study planner where a learner can add tasks, set a category and due date, mark tasks complete, filter the task list, and retain progress between visits. Keep application state separate from DOM rendering, validate input, and handle storage or parsing failures gracefully.

  1. 1Define a task data model with a unique identifier, title, category, due date, and completion status.
  2. 2Write focused functions to validate input, create tasks, update completion state, delete tasks, and filter the collection.
  3. 3Render task data into the DOM using safe APIs such as createElement and textContent.
  4. 4Add event listeners for forms, task actions, and filters; use event delegation for dynamic list items where appropriate.
  5. 5Persist task data with localStorage and validate loaded JSON before using it.
  6. 6Add loading, empty, and error states; test normal, empty, malformed-storage, and invalid-input cases.
  7. 7Organize the project into ES modules and document how to run and test it.

Progress is saved in this browser when local storage is available. You can continue without an account; changing browsers or clearing browser data may remove saved progress. Examples are not executed by the site.