Skip to content
Getting StartedChapter 1 / 47Beginner5 min read

Introduction

What JavaScript is, why it is the programming language of the web, and where it runs in browsers, servers and apps. A simple start for beginners.

On this page

1. What is JavaScript?

HTML builds the structure of a page, CSS styles it, and JavaScript gives it behavior. Doing something when a button is clicked, checking a form, loading data: all of this is JavaScript's job.

The three parts of a web page
HTML (structure)
CSS (design)
JavaScript (behavior)
Complete interactive page

The official standard for JavaScript is called ECMAScript. A new version comes out every year (ES2024, ES2025), which is why you often hear terms like "ES6" or "modern JavaScript".

2. Why does it matter?

With only HTML and CSS, a page stays static. No matter what the user does, the page shows what was written in advance. JavaScript makes the page alive.

Without JavaScriptWith JavaScript
The page only displays contentThe page reacts to user actions
A wrong form goes all the way to the serverThe form is checked instantly in the browser
New data needs a full page reloadData loads in the background, no page reload
No animations or live updatesLive search, notifications, animations

Another big reason: JavaScript is built into every browser. Without installing anything, it runs in Chrome, Firefox and Safari. That makes it the essential language for frontend development.

3. Where is it used?

AreaWhat JavaScript does
WebsitesMenus, sliders, forms, modals, live search
Web appsFull apps built with tools like React and Next.js
Server / backendAPIs and databases through Node.js, Deno and Bun
Mobile appsAndroid and iOS apps with React Native
Desktop appsApps like VS Code, built with Electron
ToolsBuild tools, scripts, automation

This means that by learning one language you can work on the frontend, the backend and mobile.

4. How does it work?

JavaScript code is run by an engine. Inside the browser there is such an engine (V8 in Chrome). The engine reads the code, turns it into something the machine understands, and runs it.

From code to result
You write JavaScript code
The browser or Node.js loads the code
The JavaScript engine runs the code
The page updates or output is shown

The details of this process are in the How JavaScript Runs chapter. For now, just remember that JavaScript needs a runtime to run, such as a browser or Node.js.

5. Code example

The smallest JavaScript program, which prints a message to the console:

js
console.log("Hello, JavaScript!");

A small interactive example that changes some text when a button is clicked in the browser:

html
<button id="greet">Click me</button>
<p id="message">Nothing has happened yet</p>

<script>
  const button = document.querySelector("#greet");
  const message = document.querySelector("#message");

  button.addEventListener("click", () => {
    message.textContent = "Thanks, you clicked!";
  });
</script>

How does the code work?

ItemMeaning
console.log()Prints a value to the console
document.querySelector()Finds one element on the page
constA variable that cannot be assigned again
addEventListener("click", ...)Runs a function when a click happens
textContentChanges the text of an element

You do not need to understand every line yet. The next chapters cover Variables, DOM Basics and DOM Events in detail.

Interview tip

If you are asked "What is the difference between JavaScript and Java?", the answer is: they are completely different languages. The similar name is only a marketing accident. JavaScript is dynamically typed and mostly runs in browsers and Node.js.

6. Common mistakes

Mistake: Thinking JavaScript is a smaller version of Java

Why? They have different syntax, typing systems and use cases. This confusion creates wrong expectations early on.

Better: Learn JavaScript as its own language, one that was built for the web.

Mistake: Starting directly with a framework

Why? Everything in React or Next.js is built on JavaScript. If your basics are weak, every error feels hard.

Better: First get comfortable with variables, functions, arrays, objects and async basics, then move on to a framework.

Mistake: Learning var and old syntax from outdated tutorials

Why? Many old tutorials rely on var and callbacks, which are used less in today's code.

Better: Learn modern syntax: let, const, arrow functions, template literals, async and await.

7. What to learn before and after

StageTopics
BeforeBasic HTML and CSS, using a computer and a browser
After thisHow JavaScript Runs, Setup & First Program
Then the basicsVariables, Data Types, Operators
Suggested order
Introduction
How JavaScript Runs
Setup and first program
Variables and data types
Functions, arrays, objects
Async JavaScript and the DOM

Final quick revision

PointDetail
What JavaScript isThe programming language of the web
JobMake pages interactive, run logic
Where it runsBrowser, Node.js, Deno, Bun
Name of the standardECMAScript (ES2024, ES2025)
Relation to JavaNone, it is a different language