Flat vector illustration explaining what is JavaScript across browsers, phones, and servers

What is JavaScript? The Honest Beginner's Guide to How It Actually Works

Ilyas elaissi
Ilyas Elaissi
10 min readJune 21, 2026

JavaScript runs on something like 98% of websites you visited today, and every modern browser ships with an engine built specifically to execute it. That is the short version. The longer version, and the one worth reading if you actually want to learn the language or decide whether to learn it, takes a few more paragraphs. So what is JavaScript, really? It is a scripting language that started life inside the browser in 1995, got a standards body wrapped around it, and now powers everything from Netflix's UI to PayPal's backend to the chat widget you ignored on a SaaS landing page this morning.

I have shipped production code in JavaScript for years. I have also been burned by it, which I will get to. Here is the explainer I wish someone had handed me when I started.

The Short JavaScript Definition (Without the Fluff)

JavaScript is a high-level, dynamically typed, interpreted programming language that was originally designed to make web pages do things after they loaded. Click a button, fetch some data, update part of the page without a full reload. That was the original job.

It has grown well past that. The same language now runs on servers (through Node.js), on phones (via React Native), on desktops (Electron apps like VS Code and Slack), and on tiny IoT devices. The language itself follows a specification called ECMAScript, maintained by a committee called TC39 under Ecma International. When someone says "ES6" or "ES2015," they are talking about a version of that spec.

A working JavaScript definition in one sentence: it is the language browsers natively understand, formalised by the ECMAScript standard, and now used far beyond the browser thanks to runtimes like Node.

A Quick History Of JavaScript (It Was Written In 10 Days)

The history of JavaScript starts at Netscape in May 1995. Brendan Eich wrote the first version in about ten days. The name was a marketing decision, riding on Java's popularity at the time, which is why beginners still ask whether they should learn Java or JavaScript thinking they are related. They are not. More on that in a moment.

The language was handed to Ecma International for standardisation in 1996, and the first ECMAScript spec came out in 1997. Things moved slowly for about fifteen years. Then ES6 dropped in 2015 and changed the language meaningfully: let and const, arrow functions, classes, modules, promises. Since then TC39 has shipped a new edition every year, which is roughly the cadence the language has held to.

The other big inflection point was 2009, when Ryan Dahl took Chrome's V8 engine and embedded it in a C++ program he called Node. Suddenly you could run JavaScript outside a browser. That single decision is why JavaScript is now a back-end language too.

What Is JavaScript Used For In Web Development And Beyond

The honest answer to "what is JavaScript and what is it used for" depends on which year you ask. For a long time it was just browser glue. Today the surface area is huge.

Here is what you can build with it:

  • Interactive websites. The original job. Form validation, dropdowns, modals, anything that responds to a click without refreshing the page.
  • Single-page applications. Gmail, Figma, Linear, Notion. The whole UI is rendered and updated by JavaScript running in your browser.
  • Server-side APIs. REST or GraphQL backends written in Node, often handling thousands of concurrent requests per process.
  • Mobile apps. React Native and Expo. The Facebook, Instagram, and Discord mobile apps all ship JavaScript.
  • Desktop apps. Electron wraps a Chromium browser around your code. VS Code, Slack, Figma's desktop client, all Electron.
  • CLIs and dev tooling. Most of the build tools you use, including Vite, ESLint, and Prettier, are JavaScript.
  • Real-time systems. Chat, multiplayer games, video call signalling. Socket-based servers are a natural fit for Node's event loop.
  • Games. Browser games via Canvas or WebGL, often with Phaser or Three.js.

So when someone asks what JavaScript is used for in web development specifically, the answer is: both sides. It writes the client-side code that runs in the user's browser, and through Node it handles server-side development too. Front-end development and back-end development in one language is the reason "full-stack JavaScript developer" became a job title.

Where The Code Actually Runs

Every browser ships with a JavaScript engine. Chrome and Edge use V8. Firefox uses SpiderMonkey, which Brendan Eich's original implementation eventually became. Safari uses JavaScriptCore. These engines parse your code, optimise it (modern engines JIT-compile hot paths, so the interpreted vs compiled code distinction is genuinely fuzzy now), and execute it.

The engine itself is the runtime. The browser adds things on top: the DOM, fetch, localStorage, setTimeout. Node adds a different set of things on top of V8: the filesystem module, network sockets, child processes. Same language, different host environment, different available APIs.

One thing that trips up beginners: JavaScript is single-threaded by design. Your code runs on one thread. But the runtime around it (browser or Node) handles I/O off that thread and notifies your code when results come back. That is why asynchronous operations using async/await and promises are so central to writing JavaScript that does not freeze. The JavaScript running order is: synchronous code first, then microtasks (resolved promises), then macrotasks (timers, I/O callbacks). Understanding that order is the difference between code that works and code that looks like it should work.

The browser also enforces a security model. Code from one origin cannot read data from another origin unless that origin opts in via CORS. This is why you cannot just fetch someone's bank API from your script. Good. You do not want that.

Flat vector illustration showing the history of JavaScript and its rapid creation

The Syntax, Variables, And Data Types You Actually Need First

Let me cover the JavaScript syntax basics quickly, because every explainer hides the actual language behind theory and I find that annoying.

Here is what is JavaScript with example code, the simplest possible piece:

console.log("Hello, world");

Open Chrome DevTools (right-click, Inspect, Console tab), paste that, hit Enter. You just ran JavaScript. No build step, no install, nothing.

Now JavaScript variables. There are three keywords, and you should mostly use one of them:

const name = "Ada";      // use this by default
let count = 0;           // use this when you need to reassign
var legacy = "avoid";    // pre-ES6, function-scoped, do not use in new code

const does not mean the value is immutable, by the way. It means the binding cannot be reassigned. You can still push to a const array. This catches everyone once.

The data types in JavaScript split into primitives and objects. Primitives: string, number, boolean, null, undefined, bigint, symbol. Everything else is an object, including arrays and functions. Because this is a dynamically typed language, a variable that holds a string today can hold a number tomorrow and the interpreter will not complain until something breaks at runtime. This is liberating when you are prototyping and miserable when you are debugging a production incident at 2am. It is also why TypeScript exists.

Functions in JavaScript are first-class values. You can pass them around, return them, assign them to variables:

function add(a, b) {
  return a + b;
}

const multiply = (a, b) => a * b;

const numbers = [1, 2, 3].map(n => n * 2);
// numbers is now [2, 4, 6]

That arrow function on line 5 is an ES6 addition. Concise, but the this binding behaves differently from a regular function, which has bitten me more than once inside class methods.

👉 Also read: How JavaScript Objects And Methods Actually Work Under The Hood

The Features Of JavaScript That Make It Weird (And Useful)

Here are the features of JavaScript that distinguish it from, say, Python or Java:

  • Prototype-based inheritance. Objects inherit from other objects directly. The class keyword added in ES6 is sugar over this.
  • First-class functions and closures. Functions remember the scope they were defined in. This is what makes callbacks, currying, and module patterns work.
  • Event loop concurrency. Single-threaded execution with non-blocking I/O. Different mental model from threads.
  • Dynamic typing with optional gradual typing via TypeScript. You can start loose and tighten later.
  • Multiple programming paradigms. You can write it object-oriented, functional, procedural, or some ugly mix of all three. The language does not force a style.
  • Truthy and falsy coercion.0, "", null, undefined, NaN, and false are falsy. Everything else is truthy. Use === instead of == and you will avoid most of the famous "JavaScript is weird" memes.

The advantages and disadvantages of JavaScript both come from the same source: it runs everywhere, was designed in a hurry, and has to stay backwards compatible with twenty-five years of code. So you get incredible reach and a language that occasionally surprises you. typeof null === "object" is a bug from 1995 that will never be fixed because too much code depends on it.

Types Of JavaScript You Will See In The Wild

When people talk about types of JavaScript, they usually mean one of three things: language versions, dialects, or runtime environments.

  • Language versions. ES5 (2009) is the old baseline. ES6/ES2015 is the big modern jump. Every yearly release since adds features, but the gap between ES5 and ES6 is the one to know.
  • Dialects and supersets. TypeScript adds static types. JSX is JavaScript with embedded HTML-like syntax for React. CoffeeScript existed and is mostly dead now.
  • Runtime environments. Browser JavaScript, Node.js, Deno, Bun, and edge runtimes like Cloudflare Workers. Same core language, different available APIs.

If you are starting out, write modern JavaScript (ES2020 or later) in the browser console, then in Node, then consider TypeScript once you feel the pain of dynamic typing on a project with more than a few hundred lines.

What Is A JavaScript Framework, And How Is It Different From A Library

The question "what is a JavaScript framework" comes up constantly, usually right next to "what is a JavaScript library." The two get used interchangeably and they should not.

A library is code you call. You decide when to invoke it. jQuery, Lodash, Axios, date-fns. You import a function, you call it, you get a result.

A framework is code that calls you. It owns the application's structure and lifecycle, and you fill in specific slots with your code. Angular and Ember are full frameworks in this sense. The JavaScript framework vs library line gets fuzzy with React (technically a library, but treated like a framework once you add a router and a state manager) and Vue (a "progressive framework" that scales between the two).

The most popular JavaScript frameworks today, by usage and job listings, are React, Vue, Angular, Svelte, and Solid for the front end, plus Next.js, Nuxt, Remix, and SvelteKit as meta-frameworks built on top of those. On the back end, Express is still the default, with Fastify, NestJS, and Hono as serious alternatives.

Pick one. Learn it deeply. The patterns transfer.

👉 Also read: How To Detect Word Wrap In A Textarea With JavaScript

Flat vector illustration showing the difference between a JavaScript framework and a library

I get this question often enough that it needs its own section. The difference between Java and JavaScript explained in one line: Java is a statically typed, compiled, class-based language that runs on the JVM. JavaScript is a dynamically typed, interpreted, prototype-based language that runs in browsers and Node. The shared name is a 1995 marketing decision and nothing more.

If you are asking "should I learn Java or JavaScript" as your first language, my honest take: JavaScript has a lower barrier to seeing something work (open a browser, you are done) and a wider range of job types. Java has a more disciplined type system and dominates large enterprise backends and Android. Neither choice is wrong. Pick the one closest to what you actually want to build in six months.

Enabling JavaScript On Your Browser And Phone

Most of the support questions I see are not about writing JavaScript but turning it on. Browsers ship with it enabled by default, but if you disabled it or are using a locked-down device, here is what you need.

On desktop Chrome. For how to enable JavaScript in Chrome, open chrome://settings/content/javascript, or go to Settings, Privacy and Security, Site Settings, JavaScript, and choose "Sites can use JavaScript." This is also the answer for how to enable JavaScript in Google Chrome since they are the same browser.

On iPhone. For how to enable JavaScript on iPhone, open the Settings app, scroll to Safari, tap Advanced, and toggle JavaScript on. Safari is the only browser engine allowed on iOS, so this setting affects every browser-shaped app on the device.

On Android. To enable JavaScript on Android in Chrome, tap the three-dot menu, Settings, Site settings, JavaScript, and switch it on. The flow is similar in Samsung Internet and Firefox Mobile.

If you just want the short version of how to enable JavaScript on your phone: it is in the browser's site settings, and it is almost certainly already on. The MDN Web Docs site has a good walkthrough if you are stuck on a less common browser, and W3Schools has beginner-friendly examples once you have it running.

What I Would Actually Tell A Beginner

If you are starting out, do not read fifteen articles before writing code. Open Chrome DevTools, paste console.log(2 + 2), watch the 4 appear, then change it. Build something small and ugly. A todo list. A tip calculator. A page that fetches weather from a public API. The point is not the project. The point is feeling how the language behaves when you push on it.

The thing nobody tells you: JavaScript will feel arbitrary for the first month. this will surprise you. Promises will feel like an over-engineered callback. Type coercion will eat one of your afternoons. That is fine. The language has weird edges because it was designed quickly and then frozen in place by the web's backwards-compatibility promise. Once you have those edges mapped, it is one of the most productive languages I have used, mostly because the feedback loop (save, refresh, see result) is shorter than anywhere else.

Stop reading. Go write some.

Get CodeTips in your inbox

Free subscription for coding tutorials, best practices, and updates.

More from CodeTips