Skip to content

Article · Programming

What Is JavaScript? The Language of the Web Explained

JavaScript makes web pages interactive and now runs servers, apps and tools. Learn what it does, how it differs from Java and Python, and what TypeScript adds.

Author
VoltKit
Published
Reading time
2 min read

JavaScript is the programming language built into every web browser. When a page reacts to a click, validates a form, loads new content without a refresh, or runs a game, JavaScript is doing the work. It was created in 1995 by Brendan Eich at Netscape in about ten days and has grown into one of the most used languages in existence.

A tiny example that responds to a button:

const button = document.querySelector("button");
let count = 0;

button.addEventListener("click", () => {
  count += 1;
  button.textContent = `Clicked ${count} times`;
});

The browser gives JavaScript access to the page (the DOM), the network, storage, graphics and much more, which is how sites like this one can compress images or merge PDFs entirely on your device without uploading anything.

Where JavaScript runs

  • Browsers. The original home. Every site with interactivity uses it, often through frameworks such as React, Vue or Svelte.
  • Servers. Node.js (2009) and newer runtimes such as Deno and Bun run JavaScript on servers, so one language can cover front end and back end.
  • Mobile and desktop apps. React Native, Electron and similar tools wrap JavaScript in native apps.
  • Tooling. Bundlers, linters, build systems and most developer utilities are written in JavaScript or TypeScript.

Key ideas

Event-driven and asynchronous. JavaScript waits for things to happen (clicks, network responses, timers) and runs functions in response, without blocking. async/await and promises make asynchronous code read like ordinary code.

Dynamic typing. Like Python, variables have no fixed type. This flexibility is why TypeScript exists: it adds optional static types so mistakes are caught before the code runs.

JSON is native. JSON syntax is a subset of JavaScript, and JSON.parse / JSON.stringify are built in, which is a big reason JSON became the web's data format.

Standardised as ECMAScript. The language specification is called ECMAScript; yearly editions (ES2015 onward) add features such as classes, modules and arrow functions.

JavaScript vs TypeScript

TypeScript is a superset: every JavaScript file is valid TypeScript. It adds type annotations (function add(a: number, b: number): number), interfaces and generics, then compiles to plain JavaScript. Large codebases, including VoltKit, use it because the compiler catches whole categories of bugs and editors can autocomplete accurately. If you have a JSON sample from an API, the JSON to TypeScript tool writes the matching types for you.

Getting started

  1. Open your browser's developer tools (F12) and use the Console tab to run console.log("hello").
  2. Create an index.html with a <script> tag and edit the page from JavaScript.
  3. Install Node.js to run scripts outside the browser and to use npm, the package registry.
  4. Read the MDN Web Docs JavaScript guide, which is the most reliable reference on the web.

Frequently asked questions

Is JavaScript the same as Java?

No. They are unrelated languages that share part of a name for historical marketing reasons. Java is a compiled, statically typed language mostly used for back-end and Android apps; JavaScript is the scripting language of web browsers.

Do I need JavaScript to build a website?

A static page needs only HTML and CSS. Anything interactive, from a dropdown menu to an online tool like the ones on VoltKit, needs JavaScript.

What is TypeScript?

TypeScript is JavaScript plus a type system. You write types alongside your code, a compiler checks them, and the output is plain JavaScript that runs anywhere.

What is Node.js?

Node.js is a runtime that runs JavaScript outside the browser, on servers and laptops. It is what makes JavaScript usable for back ends and command-line tools.

← Back to Learn

You might also like

Something useful from another corner of VoltKit.