Chapter 1 of 14
JavaScript is the only programming language that runs natively inside every web browser. It's what makes websites interactive — clicks that do things, forms that validate, content that updates without a page reload.
ANALOGY
HTML is the building, CSS is the decoration, JavaScript is the electricity. HTML structures the content. CSS makes it look good. JavaScript makes it work — it's the power that turns a static mockup into a working application. Every button click, live search, and real-time notification you've ever experienced online was JavaScript.
// This is a comment — the engine ignores it
// Two slashes start a single-line comment
/* This is a multi-line comment
Also ignored by the engine */
// Print something to the browser console
console.log("Hello, World!");
// Store a value in a variable
let name = "Nelson";
// Use the variable
console.log("Hello, " + name + "!");
// Output: Hello, Nelson!
// JavaScript can do maths
let total = 5 * 12;
console.log(total); // 60<script src="app.js"></script> to your HTML, or inline with <script>...</script>.node filename.js.