Skip to content

JavaScript Essentials

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:

LessonTopic
Types and CoercionPrimitives vs objects, typeof, == vs ===, truthy/falsy
Scope and Closuresvar/let/const, block scope, hoisting, lexical scope
this and ContextDynamic this, call/apply/bind, arrow functions
ModulesESM 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+.

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));
}
JavaScript
What does Node.js provide that a browser does not?
Which JavaScript version features does this module rely on?