Getting Started · Lesson 1 of 40
What Is JavaScript?
JavaScript is the programming language of the web. Every interactive thing you do on a website – opening a menu, liking a post, seeing search suggestions as you type – is JavaScript running in your browser. Today it also runs servers, mobile apps, desktop apps and even AI tools, which makes it the one language almost every developer meets.
In this lesson
- What JavaScript does on a web page
- Where JavaScript runs today
- How an engine like V8 executes your code
- ECMAScript versions, and JavaScript vs Java
The three languages of the web
Every web page is built from three layers
- HTML – structureheadings, paragraphs, buttons, forms
- CSS – presentationcolours, layout, fonts, animation
- JavaScript – behaviourreacts to clicks, loads data, updates the page without reloading
A product page shows the HTML and CSS instantly; JavaScript then checks stock, adds items to the cart and updates the cart count without reloading the page.
A first taste
const name = "Asha";
const marks = [78, 91, 85];
const average = marks.reduce((sum, m) => sum + m, 0) / marks.length;
console.log(`${name} scored an average of ${average.toFixed(1)}`);
if (average >= 80) {
console.log("Grade: A");
}
Asha scored an average of 84.7 Grade: A
console.log prints a value – in the browser's developer console or in the terminal when using Node.js. You'll use it constantly while learning and debugging.
Where JavaScript runs
One language, many platforms
JavaScript
- Browsersevery website; frameworks like React, Angular, Vue, LWC
- ServersNode.js, Deno, Bun – APIs with Express, NestJS, Next.js
- Mobile appsReact Native, Ionic
- Desktop appsElectron (VS Code, Slack, Discord)
- Cloud & edgeserverless functions, Cloudflare Workers
- Toolingbuild tools, linters, test runners
How JavaScript runs: the engine
Every browser contains a JavaScript engine – Chrome and Node.js use V8, Firefox uses SpiderMonkey, Safari uses JavaScriptCore. The engine turns your text into something the computer can execute:
Inside the engine
- Parseread the source and build a syntax tree
- Interpretturn it into bytecode and start running immediately
- Optimise (JIT)hot code is compiled to fast machine code while running
- Garbage collectfree memory that's no longer used
JavaScript is single-threaded: one piece of your code runs at a time. Yet it handles thousands of network requests smoothly thanks to the event loop and asynchronous code – a central topic of chapter 9.
ECMAScript: the version names
The official standard behind JavaScript is called ECMAScript. Since 2015 a new edition arrives every year:
| Edition | Highlights |
|---|---|
| ES2015 ("ES6") | let/const, arrow functions, classes, modules, promises, template literals – the start of modern JavaScript |
| ES2017 | async/await |
| ES2020 | optional chaining ?., nullish coalescing ??, BigInt |
| ES2022 | class private fields #, top-level await, .at() |
| ES2023–2024 | toSorted(), findLast(), Object.groupBy() |
This course teaches modern JavaScript as written today, and points out older patterns you'll still see in existing code.
JavaScript is not Java
The similar names were a 1995 marketing decision. The languages are very different:
| JavaScript | Java | |
|---|---|---|
| Typing | dynamic | static |
| Runs | in browsers and Node.js, from source | on the JVM, compiled to bytecode |
| Objects | prototype-based (with class syntax on top) | class-based |
| Functions | first-class values | methods inside classes (lambdas since Java 8) |
Practice
Quick check
What are the three layers of a web page?
HTML for structure, CSS for presentation and JavaScript for behaviour.
Which engine do Chrome and Node.js use?
V8.
What is ECMAScript?
The official standard that defines the JavaScript language; a new edition is published every year.
Is JavaScript a subset of Java?
No. They are unrelated languages with different typing, runtimes and object models.
Summary
- JavaScript adds behaviour to web pages and now runs on servers, mobile and desktop too.
- Engines such as V8 parse, interpret and JIT-compile it; it is single-threaded with an event loop.
- ECMAScript is the standard; ES2015 ("ES6") started modern JavaScript.
Finished this lesson?
Mark it complete to track your progress, then carry on with the next lesson.