JavaScript
The language that runs in every web browser and, with Node.js, on servers and in tools: its syntax and types, functions and objects, asynchronous code, modules, and how it works with web pages and APIs.
19 pages 123 glossary terms JSE
How to use this topic
The first seven pages cover the basics: what JavaScript is, how to run it, values and types, operators, strings, numbers and dates, and control flow. The next five are about functions and data: functions and closures, arrays, objects and JSON, classes and prototypes, and error handling. Then come asynchronous code and modules with npm, three pages on JavaScript in the browser (the DOM, fetch and debugging), and finally code quality and security.
Most examples run in Node.js and show their exact output; you can paste them into the browser console too. Examples that need a web page (the DOM, events, fetch in the browser) are shown without output. General programming ideas are explained in Programming Concepts, the event loop in Concurrency Basics, and HTTP, CORS and the browser in Web & APIs; these pages link there and focus on the language.
Pages are tagged JSE where they cover the JSE (Certified Entry-Level JavaScript Programmer) exam of the JavaScript Institute.
Learning path
- 01What Is JavaScript?What JavaScript is and where it runs: its history, the ECMAScript standard and its yearly editions, the engines inside browsers, and Node.js on servers and in tools.
- 02Running JavaScript: Browser Console and Node.jsThe places to run JavaScript while you learn: the browser console, a script tag in a web page, the Node.js REPL and script files, and printing output with console.log.
- 03Variables, Values and TypesHow JavaScript stores data: let, const and the older var, the primitive types and objects, typeof, and the difference between undefined and null.
- 04Operators, Comparison and Type CoercionArithmetic, comparison and logical operators, why === is safer than ==, truthy and falsy values, and the modern operators ?? and ?. that handle missing values.
- 05Strings and Template LiteralsWorking with text: quotes and escapes, template literals with ${} placeholders, common string methods, Unicode pitfalls, and why strings never change in place.
- 06Numbers, Math and DatesNumbers in JavaScript: one floating-point type, why 0.1 + 0.2 is not 0.3, BigInt for very large integers, the Math object, formatting, and the pitfalls of Date and its successor Temporal.
- 07Control Flow and LoopsMaking decisions and repeating work: if and else, switch, the ternary operator, for, while, for...of and for...in, and break and continue.
- 08FunctionsWriting reusable code: function declarations and expressions, arrow functions, parameters with defaults and rest, return values, scope, closures and hoisting.
- 09ArraysOrdered lists of values: creating and changing arrays, the methods map, filter, reduce and find, sorting correctly, destructuring and the spread syntax.
- 10Objects and JSONObjects as collections of named properties: creating, reading and updating them, destructuring, copying shallow and deep, Map and Set, and converting to and from JSON.
- 11Classes, Prototypes and thisObject-oriented JavaScript: classes with constructors, methods, getters and private fields, inheritance with extends, the prototype chain underneath, and what this refers to.
- 12Error HandlingDealing with things that go wrong: reading error messages, try, catch and finally, throwing your own errors, the built-in error types, and handling errors in asynchronous code.
- 13Asynchronous JavaScript: Callbacks, Promises and async/awaitHow JavaScript waits without blocking: the event loop, callbacks, promises and their states, async and await, running tasks in parallel with Promise.all, and timers.
- 14Modules and npmSplitting code into modules with import and export, the older CommonJS require, and using npm to install packages: package.json, lock files, version ranges, scripts, and supply-chain risks.
- 15The DOM and EventsJavaScript in the web page: finding and changing elements in the DOM, creating content safely, responding to clicks and form input with event listeners, and event delegation.
- 16Fetching Data from APIsCalling web APIs from JavaScript with fetch: reading JSON responses, checking status codes, sending data, handling errors and timeouts, and what CORS means for your code.
- 17Debugging and Developer ToolsFinding bugs in JavaScript: console methods beyond log, browser developer tools with breakpoints and the network panel, debugging Node.js, and a calm method for hard bugs.
- 18Code Quality: Style, Linting, Testing and TypeScriptKeeping JavaScript maintainable: consistent style with a formatter, catching mistakes with ESLint, writing tests with Node's built-in test runner, and adding types with JSDoc or TypeScript.
- 19JavaScript Security BasicsWriting JavaScript that cannot be turned against its users: avoiding cross-site scripting with safe DOM methods, never using eval on input, prototype pollution, secrets in front-end code, and safe dependencies.
JavaScript glossary
Short definitions of the terms used in this topic. The full glossary covers every topic.