Skip to content
JavaScript js getting-started 4 min read

What is JavaScript?

JavaScript is the programming language of the web. It is the only language that runs natively in every browser, and over the years it has grown far beyond the browser to power servers, command-line tools, mobile apps, and even embedded devices. If you have ever clicked a button and watched a page update without reloading, typed into a search box and seen instant suggestions, or played a game inside a tab, you have used JavaScript. This page gives you the big picture before you start writing code.

A high-level, dynamic language

JavaScript is a high-level, dynamic, single-threaded language. “High-level” means you work with concepts like objects, functions, and strings rather than memory addresses. “Dynamic” means types are checked at runtime — a variable can hold a number now and a string later, and you never declare types explicitly. “Single-threaded” means it runs one piece of code at a time, using an event loop to handle asynchronous work (network requests, timers, user input) without blocking.

Modern JavaScript engines do not simply interpret your code line by line. They use Just-In-Time (JIT) compilation: the engine starts interpreting, watches which functions run often, and compiles those hot paths to optimized machine code. This is why JavaScript can feel as fast as it does despite being so flexible.

Here is the smallest taste of the language — declaring a value and printing it:

const language = "JavaScript";
console.log(`Hello from ${language}!`);

Output:

Hello from JavaScript!

What JavaScript can build

JavaScript is genuinely a general-purpose language today. A short, non-exhaustive list of what people build with it:

AreaExamples
Interactive UIsForm validation, dropdowns, live search, single-page apps (React, Vue, Svelte)
Graphics & games2D drawing with Canvas, 3D scenes with WebGL/Three.js
Servers & APIsREST and GraphQL backends with Node.js, Deno, or Bun
ToolingBuild tools, linters, CLIs, and editor extensions
Beyond the browserDesktop apps (Electron), mobile apps (React Native), IoT

In the browser, JavaScript’s superpower is manipulating the page in response to events:

const button = document.querySelector("#greet");

button.addEventListener("click", () => {
  document.body.append("You clicked the button!");
});

ECMAScript, the DOM, and the browser

People often blur three different things together. Keeping them separate makes everything clearer:

  • ECMAScript is the official language specification — the grammar, syntax, and built-in objects like Array, Promise, and Map. JavaScript is the most popular implementation of this spec. New editions ship yearly (ES2015, ES2020, ES2024, and so on).
  • The DOM (Document Object Model) is not part of JavaScript. It is a browser-provided API for reading and changing the HTML document. Functions like document.querySelector come from the DOM, not the language itself.
  • Web APIs such as fetch, localStorage, and setTimeout are also supplied by the host environment (the browser or Node), not by ECMAScript.

The practical upshot: the language is the same everywhere, but the APIs available depend on where your code runs. document exists in a browser but not in Node; fs (file system) exists in Node but not in a browser.

JavaScript runs in two main places

┌──────────────────────┐        ┌──────────────────────┐
│      Browser         │        │   Node.js / Deno     │
│  (V8, SpiderMonkey,  │        │   (V8 runtime)       │
│   JavaScriptCore)    │        │                      │
│  + DOM, fetch, ...   │        │  + fs, http, ...     │
└──────────────────────┘        └──────────────────────┘
            \                          /
             \   same ECMAScript      /
              \   language core      /
               └────────────────────┘

The exact same syntax — arrow functions, async/await, classes, destructuring — works in both. Only the surrounding APIs differ.

A one-line history (and the Java mix-up)

JavaScript was created by Brendan Eich at Netscape in 1995, reportedly in about ten days, and was standardized as ECMAScript in 1997. The name was a marketing decision riding on the popularity of Java at the time.

Important: JavaScript and Java are unrelated languages. They share a few keywords and a C-style look, nothing more. As the saying goes, JavaScript is to Java what a car is to a carpet — similar name, different thing entirely.

Best practices

  • Use const by default and let only when you need to reassign; avoid var.
  • Prefer strict equality (===) over loose equality (==) to avoid surprising type coercion.
  • Use template literals (`Hello ${name}`) instead of string concatenation.
  • Reach for async/await rather than long .then() chains for readable asynchronous code.
  • Remember that the DOM and Web APIs are environment features, not part of the language — keep that boundary in mind when sharing code between the browser and Node.
  • Learn the language core first; frameworks come and go, but ECMAScript fundamentals carry over to all of them.
Last updated June 1, 2026
Was this helpful?