Skip to content

JavaScript Tutorial

JavaScript Tutorial: Learn Modern JavaScript Step by Step

258 lessons 5 min read By Deepak Paswan Updated Oct 4, 2026

HTML gives the page its structure and CSS makes it look good. JavaScript lets the page respond to what the user does. A button can open a menu, a form can show an error, and a page can load new data without a full reload.

This course teaches modern JavaScript from the first line to small, complete projects. Each lesson explains one idea in plain language, shows a short example you can run and change, and points out the mistakes people usually make.

What is JavaScript, and where does it run?

JavaScript is the programming language of the web. Every major browser can run it, which is why almost every interactive website uses it. You can read the full explanation in What Is JavaScript?.

JavaScript also runs outside the browser, for example in Node.js on a server. These are different runtimes: the language is the same, but the tools around it are not. This course is about browser JavaScript. Server-side JavaScript is mentioned only to make the difference clear, in Browser, Node.js and Other Environments.

HTML, CSS and JavaScript

The three work together. HTML creates a button, CSS styles it and JavaScript makes it do something. You will use that relationship throughout the course, and the lessons do not repeat the HTML and CSS curriculum. If you need it, see the HTML course and the CSS course.

Modern JavaScript, not only ES6

JavaScript is defined by a standard called ECMAScript, and it gets a new edition every year. The latest published edition is ECMAScript 2026. The course teaches the stable features developers use today (let and const, arrow functions, modules, async and await, optional chaining and more) and says so clearly when a newer feature may not work in every browser. JavaScript Versions explains the names.

What you will be able to do

By the end of the course you will be able to:

  • Write JavaScript with variables, conditions, loops, functions, arrays and objects.
  • Change a page with the DOM, respond to events and validate forms.
  • Work with JSON, browser storage and fetch().
  • Understand promises, async and await, and handle errors properly.
  • Split code into modules and use modern language features.
  • Use classes, collections, iterators and the main browser APIs.
  • Write safer, more accessible and faster code, and debug it with browser tools.
  • Build 15 small projects: a counter, a to-do list, tabs, a modal, a quiz and more.

Before you start

You need a web browser and, ideally, a little HTML and CSS. No programming experience is needed. You can write all the code in the Try it editors on this site.

How to use this course

  • Go in order. Lessons build on earlier ones. Use the chapter list on the left (or the course button on a phone).
  • Press Try it. Most examples have a Try it button that opens an editable copy with a live result or console output. Change something and press Run.
  • Read the output. Lines such as // → 24 in the code show what a console.log prints.
  • Do the exercises. Exercises and challenges are marked in the chapter list. Try them before opening the solution.
  • Break things on purpose. Errors are part of programming. Reading Console Errors shows how to read them.
lightbulb
Start here
New to programming? Begin with What Is JavaScript?. Already comfortable with the basics? Jump to the chapter you need from the list on the left.

Frequently Asked Questions

JavaScript Frequently Asked Questions

The basics are friendly: a few values, decisions and loops. What takes practice is thinking in small steps and reading error messages. Run every example, change it and break it on purpose. That is how the ideas stick.
It helps a lot, because browser JavaScript works on HTML elements and changes CSS. You do not need to be an expert. If you are new, take the HTML and CSS courses on this site first or alongside this one.
No. They are different languages. JavaScript runs in browsers and other runtimes. Java is a separate language used for servers, Android apps and more. The similar name is a historical accident.
ECMAScript is the standard that defines the JavaScript language. Browsers and runtimes implement it. New features arrive through yearly editions, and the latest published edition is ECMAScript 2026.
Only a little. The course is about browser JavaScript. Node.js is explained briefly so you know what a runtime is, but a full Node.js course is a separate subject.
No. A web browser is enough, and every example runs in the Try it editor on the page. Later you may want a code editor and the browser developer tools.

Course contents

Variables and Values

Storing values, the three ways to declare a variable and the basic data types.

Numbers and Math

Working with numbers, rounding, random values and the floating-point traps.

Conditions

Making decisions with if, else, switch and truthy or falsy values.

Loops

Repeating work with for, while, for...of and for...in.

Regular Expressions

Pattern matching for text: practical regex without the theory overload.

Forms and Validation

Reading form data, validating it and showing clear, accessible messages.

JSON

The text format for data: parse it, create it and handle bad input.

Browser Storage

Saving small amounts of data in the browser, and knowing its limits.

Error Handling

try, catch, throw, custom errors and reading what the console tells you.

Modern JavaScript

The features that define modern code, how versions and browser support work, and where ECMAScript 2026 fits.

Iterators and Generators

How for...of really works, and functions that can pause. Intermediate, not a beginner prerequisite.

Map, Set and Other Collections

Map, Set, WeakMap and WeakSet: when an object or array is not the best fit.

Classes and Object-Oriented JavaScript

Blueprints for objects: constructors, fields, private data, inheritance and composition.

Functional JavaScript

Pure functions, immutability and composition, explained with practical code.

Web APIs

The browser features you call from JavaScript: URL, history, clipboard, observers, notifications and workers.

Accessibility with JavaScript

Keyboard support, focus, ARIA, dialogs and announcements, so your interactive pages work for everyone.

JavaScript Performance

Practical habits for fast pages: less DOM work, debouncing, lazy loading and measuring before optimising.

JavaScript Security Basics

Defensive habits: XSS, safe output, URLs, sensitive data and third-party code.

Debugging JavaScript

Console methods, breakpoints, the Network and Sources panels, stack traces and a routine for finding bugs.

JavaScript Practice

Exercises, DOM challenges, broken code to debug and a quick reference.