Episode 1 — Fundamentals / 1.13 — Introduction to JavaScript
1.13.a — What is JavaScript?
In one sentence: JavaScript is a high-level, interpreted programming language that adds interactivity and logic to web pages — and today it also runs on servers, CLIs, and mobile, making it one of the most widely used languages in the world.
Navigation: ← 1.13 Overview · 1.13.b — Where JavaScript Runs →
1. What is JavaScript?
JavaScript (often abbreviated JS) is a language you use to tell the computer what to do with data and events: react to clicks, validate forms, fetch new content without reloading the page, animate UI, and build entire single-page applications.
| Layer | Technology | Role |
|---|---|---|
| Structure | HTML | What is on the page (headings, links, forms) |
| Presentation | CSS | How it looks (layout, color, typography) |
| Behavior | JavaScript | How it behaves (logic, updates, communication) |
The three work together: HTML exposes elements the user sees, CSS styles them, and JS reads and changes the DOM (the in-memory tree of the page) and reacts to user input.
2. Why JavaScript powers the web
- Ubiquity — Every major browser ships a JavaScript engine (V8 in Chrome/Edge, SpiderMonkey in Firefox, JavaScriptCore in Safari). If you write JS for the browser, it runs for billions of users without installing a runtime on their machine.
- The web platform — Browsers expose Web APIs (DOM,
fetch, timers, storage, WebSockets, etc.). JS is the standard way to use those APIs. - Node.js — The same language on the server and in build tools (bundlers, linters, test runners). One language across the stack lowers context switching for teams.
- Ecosystem — npm hosts a huge library ecosystem; frameworks (React, Vue, Svelte, etc.) are all JS-first.
3. A mental model: program vs engine
- Source code — Text you write in
.jsfiles (or inline in HTML). - Engine — Reads and executes that code (plus JIT optimization in modern engines).
- Host — Browser or Node provides globals and APIs (
documentin the browser,fsin Node — not available in both).
Same language syntax; different capabilities depending on where it runs (see 1.13.b).
4. Is JavaScript the same as Java?
No. They are unrelated languages; the name was historical marketing. Do not confuse them in interviews or documentation.
5. Key takeaways
- JS is the behavior layer of the web alongside HTML and CSS.
- It is everywhere in browsers and, via Node, on servers and tooling.
- Your code runs inside an engine hosted by a browser or Node — APIs differ by environment.
Explain-It Challenge
Explain without notes:
- In one sentence each: what HTML, CSS, and JavaScript are responsible for on a typical page.
- Name two reasons businesses choose JavaScript for web front ends.
- What is the difference between the JavaScript language and the browser as a place where JS runs?
Navigation: ← 1.13 Overview · 1.13.b — Where JavaScript Runs →