How it works
JavaScript is the only programming language browsers run directly, apart from WebAssembly. It reacts to clicks and typing, changes the page through the DOM, fetches data from APIs, and powers frameworks such as React, Vue and Svelte. It was created at Netscape in 1995 and is standardised as ECMAScript, which gains a new edition every year.
It is dynamically typed: a variable can hold a number now and text later, and type mistakes surface only when the code runs. Work that waits, such as a network request, runs asynchronously on an event loop with promises and async/await, so one slow task does not freeze the page. Node.js, Deno and Bun run the same language on servers, so one team can use one language across the whole product.
Its package registry, npm, holds millions of packages. The flip side is a sprawling ecosystem where tools and fashions change quickly, and a few historical quirks, such as loose equality with == and automatic type conversion, that catch newcomers out.
JavaScript pros and cons
Pros
- Runs in every browser with nothing to install
- One language for front end, back end and mobile (React Native)
- Vast ecosystem of packages, frameworks and tutorials
- Fast engines such as V8 make it quick for a dynamic language
- Easy to start: a text file and a browser are enough
Cons
- Dynamic typing lets many mistakes through until run time
- Historical quirks (type coercion, this, ==) catch people out
- Fast-moving ecosystem with deep dependency trees
- Slower than compiled languages for heavy number crunching
When to use JavaScript
Pick it when
- Anything that has to run in a web browser
- Small scripts, prototypes and pages with a little interactivity
- A full-stack team that wants one language on front and back end
Skip it when
- A codebase that will grow large (TypeScript adds safety at little cost)
- CPU-heavy work such as video encoding or large simulations
JavaScript pricing
Free
Free: built into every browser, and Node.js, Deno and Bun run it on servers at no cost.
Approximate, checked September 2026.What the other tools cost
JavaScript vs the alternatives
- JavaScript vs TypeScriptTypeScript is JavaScript with a type checker on top, so this is less a choice between languages than a choice of how much the tools check for you before the code runs.
- Python vs JavaScriptTwo of the most common first languages. Both are easy to start with and dynamically typed; they differ mostly in where they run and what their ecosystems are built for.
Related terms
More in Programming languages
Web