JavaScript Essentials
JavaScript is the language of Node.js
Section titled “JavaScript is the language of Node.js”Node.js is a runtime that executes JavaScript outside the browser. Everything you write in Node — from a simple HTTP server to a complex CLI tool — is JavaScript. That means a solid grip on the language itself is non-negotiable before diving into Node’s APIs.
This module covers the JavaScript fundamentals that trip up developers most in the Node ecosystem:
| Lesson | Topic |
|---|---|
| Types and Coercion | Primitives vs objects, typeof, == vs ===, truthy/falsy |
| Scope and Closures | var/let/const, block scope, hoisting, lexical scope |
this and Context | Dynamic this, call/apply/bind, arrow functions |
| Modules | ESM import/export vs CommonJS require, when to use each |
Modern JavaScript means ES2022 and later throughout — const/let, arrow functions, destructuring, async/await, optional chaining, and native ES modules. This module uses Node 20+.
A first runnable demo
Section titled “A first runnable demo”The snippet below demonstrates several JS concepts at once: a const declaration, a function, a template-string-free concatenation, and a closure over the outer variable. Run it and inspect the output.
const greet = function(name) { return 'Hello, ' + name + '!';};
const languages = ['JavaScript', 'TypeScript', 'Node.js'];
for (const lang of languages) { console.log(greet(lang));}