Skip to main content
Programming

JavaScript Tutorial with Examples.

JavaScript tutorial covering modern fundamentals, DOM manipulation, async patterns, Promises, fetch and the ES module system, each with real output.

Beginner

Start here — no prior experience needed

13 lessons
javascript beginner
5 min read

Learn what JavaScript is, its history, how it powers the modern web, and why it's the most widely used programming language in the world.

javascript beginner
5 min read

Install Node.js and npm, configure VS Code with the right extensions, and run your first JavaScript program from the terminal.

javascript beginner
5 min read

Understand the differences between var, let, and const — including hoisting, temporal dead zone, block scope, and when to use each one.

javascript beginner
5 min read

Explore JavaScript's seven primitive types and objects, understand typeof, type coercion, and learn how to check types reliably.

javascript beginner
5 min read

Master JavaScript operators — arithmetic, comparison, logical, nullish coalescing, optional chaining, spread, and ternary — with real-world examples.

javascript beginner
5 min read

Learn how to direct your program's execution with if/else, switch, loops (for, while, for...of, for...in), break, continue, and labeled statements.

javascript beginner
5 min read

Master JavaScript functions — declarations, expressions, arrow functions, default and rest parameters, IIFEs, and first-class function patterns.

javascript beginner
5 min read

Learn how to create, manipulate, and transform strings in JavaScript using template literals, built-in methods, and regular expressions.

javascript beginner
5 min read

Go beyond basic regex matching: why a shared /g regex's test() method alternates true and false on the same string, named capture groups with matchAll, replace() with a callback, and RegExp.escape for safely building patterns from user input.

javascript beginner
5 min read

Learn JavaScript arrays — creation, functional methods like map/filter/reduce, destructuring, sorting, and common transformation patterns.

javascript beginner
5 min read

Learn JavaScript objects — literals, destructuring, spread/rest, Object utility methods, symbols, and patterns like config merging.

javascript beginner
5 min read

Learn JavaScript's Map and Set: object-key coercion, insertion order, the new ES2025 Set operations, and why WeakMap and WeakSet can't be iterated.

javascript beginner
5 min read

Learn what JSON.stringify actually drops and rewrites — undefined and functions vanish, Date becomes a string, Map becomes {}, BigInt and circular references throw — and how toJSON and a reviver fix it.

Intermediate

For developers with core concepts down

15 lessons
javascript intermediate
5 min read

Learn how to handle errors in JavaScript — try/catch/finally, built-in error types, custom error classes, rethrowing, and async error patterns.

javascript intermediate
5 min read

Date's setMonth silently rolls a short month into the next one. See Temporal.PlainDate clamp the same case instead, a DST change split +1 day from +24 hours, until() measure a real gap, and overflow: "reject" throw instead of guessing.

javascript intermediate
5 min read

Learn ES6 classes, inheritance, private fields, static members, getters/setters, and the mixin pattern for composing behavior in JavaScript.

javascript intermediate
5 min read

Understand how JavaScript's prototype chain works, prototype-based inheritance, and how ES6 classes relate to prototypes under the hood.

javascript intermediate
5 min read

Learn what closures are, how lexical scoping works, and how to use closures for private state, memoization, and module patterns.

javascript intermediate
5 min read

Learn how JavaScript's this is bound at call time, why detaching a method loses it, and how call, apply, and bind control it explicitly.

javascript intermediate
5 min read

Understand how JavaScript's single-threaded event loop works, why microtasks run before macrotasks, and how to reason about async execution order.

javascript intermediate
5 min read

Master async JavaScript by understanding callbacks, Promises, and async/await — including error handling, parallel execution, and the full Promise API.

javascript intermediate
5 min read

Learn the iterator protocol behind for...of and spread, make your own objects iterable, and use generators for lazy pipelines and async iteration.

javascript intermediate
5 min read

Understand ES modules and CommonJS, their syntax differences, dynamic imports for code splitting, and how bundlers like Vite and webpack fit in.

javascript intermediate
5 min read

Learn how to select, create, modify, and remove DOM elements, handle events with delegation, and avoid common security pitfalls like XSS.

javascript intermediate
5 min read

A practical guide to the most useful browser Web APIs — Fetch, localStorage, Intersection Observer, Web Workers, WebSockets, and Geolocation.

javascript intermediate
5 min read

Learn Node.js CLI args, env vars, fs/promises, readline, and streams, including backpressure and error propagation through stream/promises pipeline.

javascript intermediate
5 min read

Learn how to write reliable unit tests in JavaScript using Jest and Vitest — from basic assertions to mocking, async tests, and code coverage.

javascript intermediate
5 min read

35 essential JavaScript interview questions with detailed answers and code examples — closures, hoisting, event loop, prototypes, async/await, and more.

Advanced

Production-grade patterns for experienced engineers

4 lessons

Also part of JavaScript

Taught in other topics. Each link opens the lesson in its home topic.

1 lesson