Most JavaScript tutorials are written for the browser: buttons, forms and the DOM. If you want to become a backend developer, much of that is not what you need first.
JavaScript: Basics to Advanced is a free course that teaches the JavaScript language for backend work. In 25 sessions it takes you from your first console.log() to promises, async/await and calling APIs with fetch. Everything runs in Node.js, and every example has been tested.
mohin-sheikh
/
javascript-basics-to-advanced
A structured JavaScript practice repository covering everything from variables and loops to closures, async programming, and ES6+ features. Designed to help you learn by doing with practical examples and exercises.
JavaScript: Basics to Advanced
A free, beginner-friendly JavaScript course for future backend developers.
25 sessions take you from your first console.log() to promises, async/await and calling APIs with fetch. Everything runs with Node.js, and every example is tested.
Table of Contents
- What Makes This Course Different
- Who This Course Is For
- What You Need
- Quick Start
- How to Use This Course
- Course Outline
- A Look Inside
- Find a Topic Fast
- What You Will Be Able to Do
- After This Course: Node.js
- Repository Structure
- Feedback
What Makes This Course Different
| Backend from day one | No web pages, buttons or browser code. You run everything with node file.js in a terminal, with examples from real servers: users, orders, carts, logins and APIs. |
| Every example is tested | 587 example files were run on Node.js 24. The output in each session is the real output, so you can compare it with |
What Makes This Course Different
-
Backend from day one. There are no web pages or browser code. You run every example with
node file.js, and the examples come from real servers: users, orders, carts, logins and APIs. - Every example is tested. 587 example files were run on Node.js 24. The output shown in each session is the real output, so you can compare it with yours line by line.
- Learn by seeing. 319 animated diagrams show what happens inside your program: variables, the call stack, closures, the event loop and promises.
- Learn from mistakes. 266 common beginner mistakes, each with the wrong code, what goes wrong and the fix.
- Practice and interview prep. 199 practice exercises and 337 interview questions with answers.
- One idea at a time. A session only uses what earlier sessions taught. Nothing appears before it has been explained.
Who It Is For
- Complete beginners who have never written a line of code
- Anyone who wants to become a backend or full-stack developer
- Frontend developers who use JavaScript every day but never learned how it really works
- Anyone preparing for a JavaScript or Node.js interview
You need a computer (Windows, macOS or Linux), Node.js 22 or newer, and a code editor such as VS Code. No programming experience is needed.
Course Outline
Part 1: Basics
The building blocks of every program: values, decisions and repetition.
| # | Session | You will learn |
|---|---|---|
| 01 | Introduction to JavaScript | What JavaScript and Node.js are, setting up, your first program, reading errors |
| 02 | Variables and Comments |
let, const, var, naming rules and comments |
| 03 | Data Types | The 8 data types, typeof, null and undefined
|
| 04 | Operators | Arithmetic, comparison, === vs ==, logical operators and ??
|
| 05 | Type Conversion |
Number(), parseInt(), truthy and falsy, safe input handling |
| 06 | Conditionals |
if, else if, switch, the ternary operator, validation |
| 07 | Loops |
for, while, do...while, for...of, break and continue
|
| 08 | Strings and Template Literals | Template literals, escape characters and string methods |
| 09 | Numbers and Math | Decimals, money in paise, rounding, Math methods and random numbers |
Part 2: Building Blocks
Organising code and data: functions, arrays, objects and classes.
| # | Session | You will learn |
|---|---|---|
| 10 | Functions | Parameters, return, default values, arrow functions, the call stack, recursion |
| 11 | Callbacks and Higher-Order Functions | Callbacks, function factories, setTimeout and error-first callbacks |
| 12 | Arrays and Array Methods |
push, splice, map, filter, reduce, find, sorting, split and join
|
| 13 | Objects | Properties, nested objects, ?., Object.keys, arrays of objects |
| 14 | Destructuring, Spread and Rest | Unpacking arrays and objects, copies and merges with ..., rest parameters |
| 15 | Shallow and Deep Copy | References, shallow copies, structuredClone, shared-data bugs on a server |
| 16 | Scope, Hoisting and Closures | The scope chain, var vs let, hoisting, the temporal dead zone, closures |
| 17 | this, Constructors and Classes |
this, new, classes, private fields, getters, static and extends
|
Part 3: Real Programs
What every real backend program needs: error handling, data formats, collections, and code split into files.
| # | Session | You will learn |
|---|---|---|
| 18 | Error Handling |
try, catch, finally, throw, custom error classes, status codes |
| 19 | JSON and Dates |
JSON.stringify, JSON.parse, invalid JSON, dates, time zones, date math |
| 20 | Map and Set |
Map, Set, removing duplicates, caches and set operations |
| 21 | Modules |
require, module.exports, ES modules with import/export, project structure |
Part 4: Async JavaScript
How one Node.js thread serves many users: waiting without blocking.
| # | Session | You will learn |
|---|---|---|
| 22 | Timers |
setTimeout, setInterval, retries with backoff, debouncing, timeouts |
| 23 | The Event Loop | The call stack, queues, microtasks, blocking code and the thread pool |
| 24 | Promises | Creating promises, then/catch/finally, chaining, Promise.all, race, any
|
| 25 | async/await and fetch |
async functions, await with try...catch, parallel tasks, calling APIs with fetch
|
A Look Inside
Every session explains the hard parts with animated diagrams. Here are three of them.
Session 23: the event loop, explained as a restaurant
Session 24: the three states of a promise
Session 25: what happens during a fetch call
What Every Session Contains
| Part of a session | What it gives you |
|---|---|
| Short sections | One idea at a time, in simple words, with tables for quick review |
| Tested code examples | A file name, the code, and the real output |
| Animated diagrams | A picture of what happens while the code runs |
| Mini examples | One or two small backend programs that combine the session's topics |
| Beginner mistakes | The wrong code, the real error, and the correct code |
| Practice exercises | Tasks to do on your own |
| Interview questions | Short questions with clear answers, to check yourself |
Plan for 1 to 2 hours per session, including the exercises. At one session a day, most learners finish in 4 to 5 weeks.
Start in Five Minutes
1. Install Node.js (the LTS version from nodejs.org) and check it in a terminal. Any version from 22 up works.
node -v
v24.19.0
2. Make a practice folder called js-practice and open it in VS Code (File > Open Folder).
3. Create a file called hello.js in that folder.
console.log("Hello, JavaScript!");
4. Run it in the VS Code terminal (Terminal > New Terminal).
node hello.js
Hello, JavaScript!
That is how you run every example in the course. Now open Session 01.
How to Study
- Go in order. Each session builds on the ones before it. The links at the bottom of every session take you to the next one.
- Type the code yourself. Don't copy and paste. Typing teaches you the syntax, and your own typos teach you to read error messages.
- Run it and compare. Every example shows its exact output. If yours is different, find out why before you move on.
- Break things on purpose. Change a value or delete a line, predict what will happen, then run it.
- Finish each session. Read the beginner mistakes, do the exercises, and answer the interview questions out loud before you look at the answers.
When You Get Stuck
- Read the error message. Node.js shows the file name, the line number and the exact place of the problem. Session 01 teaches you how to read it.
- Compare your output with the output in the session, line by line.
- Check the beginner mistakes at the end of the session. Your bug is often already there.
- Search the exact error message online. Someone has almost always seen it before.
- Take a break. A problem that looks impossible tonight is often easy tomorrow.
Study Tips
- Code a little every day. 30 minutes daily beats 5 hours once a week.
- Keep short notes in your own words, especially of the mistakes you made.
- Explain each concept out loud, as if you were answering an interview question.
- Go back to earlier sessions whenever a new one feels hard. That is part of learning, not a step back.
Find a Topic Fast
Revising for an interview? Jump straight to a topic.
| Topic | Session |
|---|---|
let vs const vs var
|
02, 16 |
== vs ===
|
04 |
| Truthy and falsy values | 05 |
Why 0.1 + 0.2 is not 0.3
|
09 |
map, filter and reduce
|
12 |
| Copying objects without bugs | 15 |
| Closures and hoisting | 16 |
this and classes |
17 |
Custom errors and try...catch
|
18 |
require vs import
|
21 |
| The event loop and microtasks | 23 |
Promises, Promise.all and Promise.race
|
24 |
async/await and fetch
|
25 |
The README has the full list.
What You Will Be Able to Do
- Write, run and debug JavaScript programs with Node.js
- Read error messages and stack traces, and fix the cause
- Work with strings, numbers, arrays and objects the way backend code does: input checks, money in paise, lists of users and orders
- Organise code with functions, classes and modules
- Handle errors cleanly and turn them into the right HTTP status codes
- Explain closures,
this, the event loop and promises in an interview - Write asynchronous code with
async/await, and call other servers withfetch
What Comes Next: Node.js
This course teaches the JavaScript language. The Node.js course uses it to build real servers, REST APIs with Express, and databases with MongoDB, in 30 more sessions. Both courses use the same style and the same examples, so the step from one to the other is small.
Help It Reach More Learners
If this course helps you, please star the repository on GitHub so others can find it too. Found a mistake, or a part that is hard to understand? Open an issue. Every report helps the next learner.
Which JavaScript topic did you find hardest when you started? Tell me in the comments.
Start with Session 01: Introduction to JavaScript
Author: Mohin Sheikh. Follow me on GitHub for more free courses and updates.





Top comments (0)