Topic 01 / 15
Introduction to JavaScript & Setup
The Language of the Web
JavaScript is the only language browsers execute natively — every interactive website you’ve ever used runs it. Since Node.js, it also runs servers, build tools, and CLIs. One language, full stack: that’s why JS has been the world’s most-used language for over a decade.
Where to Run It
1. The browser console — press F12, open the Console tab, and type:
2 + 2 // 4
console.log("Coding India") // prints to the console2. A script in a page — create two files:
<!-- index.html -->
<!DOCTYPE html>
<html>
<head><title>JS Lab</title></head>
<body>
<h1 id="title">Hello</h1>
<script src="app.js"></script> <!-- bottom of body -->
</body>
</html>// app.js
console.log("script loaded");
document.getElementById("title").textContent = "Hello from JS";3. Node.js — install from nodejs.org and run files directly:
node app.jsStatements & Comments
// single-line comment
/* multi-line
comment */
let x = 5; // semicolons are technically optional —
let y = 10; // but use them; it avoids rare parsing surprisesStrict Mode & Modern JS
This series teaches modern JavaScript (ES6+): let/const, arrow functions, template literals, modules, async/await. You’ll still see pre-2015 code in the wild (var, function callbacks everywhere) — we’ll flag the old patterns so you can read them, but you’ll write the new ones.
console Is Your Best Friend
console.log("value:", x);
console.warn("careful");
console.error("something broke");
console.table([{name: "Ravi", score: 82}, {name: "Asha", score: 99}]);