What it is
Programming language
Interactive web pages, Node.js servers, and more.

This page is a self-contained introduction to JavaScript (JS)—the language that powers interactive websites. You will understand what JavaScript is, how engines run your code, and write your first programs for the browser and console.
Programming language
Interactive web pages, Node.js servers, and more.
console.log
Run your first line in Node.js or the browser console.
Engine & DOM
V8 parses and runs JS; the event loop handles async work.
Browser & Node
Script tags, DevTools Console, or node file.js.
5 labs
Hello World, variables, functions, if-else, and DOM updates.
JS track
Continue to file handling, DOM, async, and frameworks.
JavaScript (often shortened to JS) is a popular programming language used for creating interactive and dynamic web content. It is primarily used for front-end web development, allowing developers to add dynamic effects, animations, and functionality to web pages.
JavaScript can also power back-end development through Node.js, build mobile apps with React Native, create games, and even control robots and IoT devices. It is one of the most widely used languages in the world.
Together with HTML (structure) and CSS (style), JavaScript completes the trio of core web technologies. HTML builds the page skeleton; CSS makes it look good; JavaScript makes it do something when users click, scroll, or submit forms.
Learn basic HTML and CSS first, then add JavaScript to change text, respond to clicks, and fetch data. You will see results immediately in the browser.
Browsers, Node.js, mobile apps, and tooling share one language.
Update HTML in real time when users click, type, or scroll.
Async timers, fetch, and callbacks without blocking the UI.
Open standard (TC39); engines like V8 are open source.
In short: JavaScript is the programming language of the web—not the same as Java—and it makes pages interactive.
Brendan Eich is known as the creator of JavaScript. He built the first version in just 10 days in May 1995 while working at Netscape Communications Corporation.
The language was originally called Mocha, then renamed LiveScript, before finally becoming JavaScript. Eich continued to shape the language and later co-founded the Mozilla project. Today JavaScript is standardized as ECMAScript by TC39.
| Version / Event | Year | Highlight |
|---|---|---|
| JavaScript created | 1995 | Brendan Eich, Netscape (10 days) |
| ECMAScript 1 | 1997 | First official standard |
| AJAX era | ~2005 | Dynamic pages without full reloads |
| ES5 | 2009 | Strict mode, JSON support |
| Node.js released | 2009 | JavaScript on the server |
| ES6 / ES2015 | 2015 | let, const, classes, modules, arrow functions |
| Annual releases | 2016+ | ES2016, ES2017, async/await, etc. |
| ES2024 | 2024 | Array grouping, improved RegExp |
When JavaScript runs, the browser or Node.js loads your code into a JavaScript engine (such as V8 in Chrome and Node, or SpiderMonkey in Firefox). The engine parses source code, compiles it to optimized machine code (often via JIT compilation), and executes it.
During execution, the engine manages memory and handles asynchronous work through an event loop—timers, network responses, and user events are queued and processed without blocking the main thread.
In the browser, JavaScript can interact with the Document Object Model (DOM)—a tree representation of HTML—to read and update page content, styles, and event listeners in real time.
Start with variables, strings, numbers, and if/for loops. Use browser DevTools (F12 → Console) to experiment instantly.
Here is a simple JavaScript program that prints Hello, World! to the console:
console.log("Hello, World!"); Run it with node demo.js in a terminal, or paste the line into your browser’s DevTools Console.
; (optional in many cases, but good habit)' or double " quotes (or backticks for templates)// line or /* block */myVar and myvar are differentfunction name() { } or arrow () => { }You can run JavaScript in three common ways while learning:
node demo.js <script>
console.log("Hello from the browser!");
</script> .js fileYes. JavaScript is standardized as ECMAScript, an open specification maintained by TC39. Implementations—V8, SpiderMonkey, JavaScriptCore—are open-source projects you can read, use, and contribute to.
You do not need a license to write JavaScript. Frameworks and tools built on top (React, Vue, Node.js, Express) are also overwhelmingly open source.
| Concept | What it does |
|---|---|
| Variables | let, const store data |
| Data types | String, number, boolean, object, array, null, undefined |
| Operators | Arithmetic, comparison, logical |
| Control flow | if, else, switch, loops |
| Functions | Reusable blocks of code |
| Objects & arrays | Group related data and methods |
| DOM API | Read and update HTML from JS |
| Async | Promises, async/await, fetch |
| Task | Example |
|---|---|
console.log("Hi"); | |
| Variable | const age = 20; |
| Condition | if (x > 0) { ... } |
| Loop | for (let i = 0; i < n; i++) { ... } |
| Function | function add(a, b) { return a + b; } |
| Select DOM | document.getElementById("msg") |
Same language—three everyday runtimes while you learn.
F12 → ConsolePaste a line and press Enter for instant feedback
console.log(...)Embed JS in a page or link an external .js file
node demo.jsRun scripts and tools from the terminal
Reach for JS when the page needs behavior—not just structure or style.
Clicks, forms, menus, and live validation in the browser.
Load JSON and update the page without a full reload.
Same language for front-end frameworks and Node.js APIs.
Static content and layout do not need JavaScript until you add behavior.
Key benefit: one language covers interactive websites and server-side Node.js—a strong full-stack path.
Five starter programs. Use View Output to preview here, or open Try It Yourself to edit and run live in the browser.
Print a string to the console—the classic first program.
console.log("Hello, World!"); console.log writes to the terminal (Node) or the browser DevTools Console. It is the fastest way to inspect values while learning.
Store strings, numbers, and booleans with const and let.
const name = "Alex";
let age = 20;
const isStudent = true;
console.log(`Name: ${name}`);
console.log("Age:", age);
console.log("Student:", isStudent); Use const for values that won’t be reassigned; use let when the value changes. Template literals with backticks interpolate ${name}.
Group reusable logic that takes inputs and returns a result.
function add(a, b) {
return a + b;
}
console.log("Sum =", add(3, 5)); add(3, 5) calls the function with arguments a and b. return sends the sum back to the caller.
Branch with conditions using the remainder operator.
const n = 7;
if (n % 2 === 0) {
console.log(n, "is even");
} else {
console.log(n, "is odd");
} n % 2 is the remainder after dividing by 2. Prefer === for strict equality checks.
Listen for a click and change text on the page.
<p id="greeting">Loading...</p>
<button id="btn">Say Hello</button>
<script>
document.getElementById("btn").addEventListener("click", function () {
document.getElementById("greeting").textContent = "Hello, JavaScript!";
});
</script> getElementById finds nodes in the DOM. addEventListener runs your function on click and updates textContent—classic front-end interactivity.
Where JavaScript shows up across the modern stack.
Menus, forms, animations, and live content updates in the browser.
Example: toggle a mobile nav on click.
React, Vue, and similar frameworks are built on JavaScript.
Example: a dashboard that updates without reloads.
Build servers, CLIs, and tooling with the same language.
Example: Express REST API.
Reuse JS skills for iOS and Android apps.
Example: cross-platform product app.
Call backends and update the UI when JSON arrives.
Example: weather widget with fetch.
npm scripts, build tools, and small Node utilities.
Example: rename files or generate reports.
Why teams and beginners choose JavaScript.
Runs in all major browsers without plugins.
Same language for front-end frameworks and Node.js backends.
See results in the console or browser immediately.
npm packages, frameworks, and jobs across the industry.
Habits that keep early JavaScript practice productive.
Skip var in new code. Default to const; use let when reassignment is needed.
Press F12, paste snippets, and read errors from top to bottom.
Strict equality avoids surprises like 0 == false.
Mistakes that commonly trip up new JavaScript learners.
Similar names; unrelated languages and runtimes.
→ Treat JS as its own language from day one.
Loose equality coerces types in surprising ways.
→ Prefer === and !== in almost all comparisons.
Calling APIs without understanding promises leads to race bugs.
→ Learn async/await before production fetch code.
Anything shipped to the browser is visible to users.
→ Keep API keys and private logic on the server.
The browser downloads your page and JavaScript files (inline or external).
V8 or similar parses code, optimizes hot paths, and executes bytecode.
Scripts query the DOM, attach listeners, and respond to clicks and input.
Content updates, animations run, and fetch loads data without full reloads.
Quick Takeaway: Start with console.log, variables, and functions; then wire clicks to the DOM and grow into async and frameworks.
JavaScript runs in every major browser and on the server via Node.js. Logos use the shared browser-image-sprite.png sprite from this project.
Load a script tag or run node file.js. Engines like V8 and SpiderMonkey execute modern ECMAScript in browsers and Node.
Bottom line: Safe for learning demos in any modern browser. Prefer evergreen browsers and current Node LTS for production.
JavaScript is the core scripting language of the web. Engines compile and run your code; the event loop handles async work; the DOM connects scripts to HTML so pages respond to users.
Practice variables, functions, and DOM updates next. Continue to the JavaScript track for file handling, then explore async patterns and frameworks when you are ready.
Type the examples yourself—reading alone is not enough to learn JavaScript.
const by default; let when reassignment is needed=== over == for comparisonsuserCount, not x)var in new code (prefer let/const)0 == false is trueYour gateway to the DOM, Node.js, and modern web frameworks.
Interactive pages & Node.js
BasicsParse, JIT, event loop
RuntimeUpdate HTML from JS
BrowserOpen standard by TC39
Specconsole.log first
Run JavaScript in the browser with a <script> tag or in Node.js with node file.js. Use console.log() to print output. The language is standardized as ECMAScript; engines like V8 and SpiderMonkey are open source. JavaScript was created by Brendan Eich in just 10 days in May 1995—marketing chose the name to ride Java’s popularity, even though the languages are unrelated.
Run your first console.log in the live editor, then explore variables and the DOM.
14 people found this page helpful