Last 30 Days
No notifications
JavaScript is the language of the web — every browser ships with a JS engine, and Node.js lets the same language run on servers, build tools, and CLIs. It's dynamically typed, single-threaded but asynchronous, and the most-used programming language on the planet. You can start writing it in any browser's DevTools console — no install, no compiler.
# Introduction to JavaScript
let, const, arrow functions, classes, modules, Promises. *The* modern-JS turning point.async / await.console.log("hello, world");
1 + 2 * 3; // → 7 in HTML<!doctype html>
<html>
<body>
<h1 id="t">Hi</h1>
<script type="module">
document.getElementById("t").textContent = "Hello from JS!";
</script>
</body>
</html>
type="module" enables modern import/export. Use it as the default.node --version # v20.x
echo "console.log(2+2)" > add.js
node add.js # 4
Or open the REPL: node, then type expressions interactively.// variables
const name = "alice";
let count = 0;// functions (two flavours)
function add(a, b) { return a + b; }
const mul = (a, b) => a * b;
// data
const user = { id: 1, name, tags: ["admin", "ops"] };
console.log(hi ${user.name});
// control flow
for (const t of user.tags) console.log(t);
// async
fetch("/api/me")
.then(r => r.json())
.then(console.log);
"5" + 3 gives "53", [] == false is true. The modern style sidesteps the pitfalls: use === over ==, const/let over var, ESLint + Prettier in your editor, and you'll write code as crisp as any compiled language.