Learn JavaScript + Node.js from zero to hero β Malaysian style! π²πΎ
A complete, beginner-friendly JavaScript + Node.js learning guide with hands-on lessons, exercises, and solutions. Written in fun Malaysian English so you won't fall asleep reading code. Confirm shiok one!
New to programming? Start at Lesson 00 and go in order. Part 1 is pure JavaScript β you don't need to know anything before starting.
This repo is Phase 1 of a three-phase journey:
- Phase 1 β THIS repo (
node-fundamentals): JavaScript + Node core β confident Node developer (CLI tools, file scripts, simple servers) - Phase 2 β
node-backend(coming soon): Express/Fastify, REST APIs, databases, auth, testing, deployment β professional backend developer - Phase 3 β
node-advanced(coming soon): streams deep-dive, worker threads, performance, security, TypeScript β master
Part 1 β JavaScript (Lessons 00β11): the language itself, running in Node.
| # | Lesson | Topics |
|---|---|---|
| 00 | Hello Node! | What is Node, node vs browser, running scripts |
| 01 | Variables & Types | let, const, var, typeof, numbers, strings, booleans |
| 02 | Operators & Coercion | Arithmetic, == vs ===, truthiness, short-circuit |
| 03 | Strings & Template Literals | Methods, slicing, template literals, .includes() |
| 04 | Arrays | map, filter, reduce, spread, destructuring |
| 05 | Objects & JSON | Object literals, destructuring, JSON.parse/stringify |
| 06 | Control Flow | if/else, switch, ternary, logical operators |
| 07 | Loops | for, while, for...of, for...in, break, continue |
| 08 | Functions | function declarations, arrows, callbacks, default params |
| 09 | Scope & Closures | Block scope, hoisting, closures, IIFE |
| 10 | Error Handling | try/catch/finally, throw, custom errors |
| 11 | Async JavaScript | Callbacks, Promises, async/await β the bridge to Node |
Part 2 β Node Runtime (Lessons 12β19): what makes Node special.
| # | Lesson | Topics |
|---|---|---|
| 12 | Modules | CommonJS require, module.exports, ESM import |
| 13 | npm | init, install, package.json, scripts, semver |
| 14 | File System | fs read/write, path, sync vs async |
| 15 | Events | EventEmitter, on/emit, once |
| 16 | Streams & Buffers | Buffers, readable/writable streams, pipe |
| 17 | HTTP & Servers | http.createServer, routes, JSON API |
| 18 | CLI & Process | process.argv, env, exit codes, stdin |
| 19 | Capstone: Todo CLI | Build a real todo app with file persistence |
- Node.js 24 LTS or newer β download from nodejs.org
- Nothing else! No frameworks, no dependencies. Everything runs with plain
node.
Check your version:
node --version # should print v24.x.x or higher-
Clone the repo:
git clone https://github.com/subimpact/node-fundamentals.git cd node-fundamentals -
Read and run lessons in order:
node lessons/00_hello_node.js node lessons/01_variables_and_types.js # ... and so on(Not sure if your output is right? Check EXPECTED_OUTPUTS.md!)
-
Try the exercises:
# Open the exercise file, fill in the TODOs # Then run it. There are built-in Malaysian checkers to guide you! node exercises/01_variables_exercises.js # Check the solutions when you're done: node solutions/01_variables_solutions.js
-
Run everything at once (lessons + solutions must all pass):
npm test
node-fundamentals/
βββ README.md β You are here!
βββ LICENSE β MIT License
βββ .gitignore β Git ignore rules
βββ package.json β Project metadata + npm test
βββ EXPECTED_OUTPUTS.md β What each lesson should print
βββ CHANGELOG.md β Version history
βββ CONTRIBUTING.md β How to help out
βββ lessons/ β 20 lesson files (read + run these!)
βββ exercises/ β 13 exercise files with built-in checkers
βββ solutions/ β 13 solution files
βββ scripts/
βββ verify.js β Runs every lesson + solution (npm test)
Each exercise file has TODO comments where you write your code, and a checker at the bottom that tests your answers automatically:
$ node exercises/04_arrays_exercises.js
β
double([1, 2, 3]) β betul!
β
evens([1, 2, 3, 4, 5, 6]) β betul!
β total([1, 2, 3])
got: 6
expected: 7No setup, no test framework β just run the file and see how you did. Solutions are in solutions/ when you're stuck.
See CONTRIBUTING.md β terima kasih in advance! π²πΎ
MIT β use it, share it, teach with it. Just keep the attribution.