Skip to content

175 chapters, 4 courses, free

Learn web development, one clear chapter at a time

From JavaScript to Next.js and production-grade best practices. Every topic is one short, focused chapter: definition, code example, common mistakes and quick revision.

  • Completely free
  • No sign-up
  • React 19.2 and Next.js 16
javascript / closures
FunctionsChapter 16 / 475 min read

Short definition

A closure is a function that remembers the variables of the scope it was created in.

function createCounter() {
  let count = 0;

  return () => {
    count += 1;
    return count;
  };
}

const next = createCounter();
next();
next();

Mistake: closures with var inside a loop

Better: use let, so every iteration gets its own scope.

Courses
4
Chapters
175
Always
Free
Sign-ups needed
0

Courses

Pick your course

Every course is split into sections, and every chapter shows its level.

Chapter structure

Every chapter follows the same order

You always know what comes next, so your focus stays on the concept, not the layout.

  1. 01

    What is it?

    A one-line definition, then a simple explanation.

  2. 02

    Why does it matter?

    The real problem it solves, before and after.

  3. 03

    Where is it used?

    Examples from real projects.

  4. 04

    How does it work?

    A mental model and a step-by-step flow.

  5. 05

    Code example

    Short, runnable code and what each line does.

  6. 06

    Common mistakes

    The mistake, why it happens and the better way.

  7. 07

    What next?

    Links to the chapters before and after.

  8. 08

    Quick revision

    Key points at a glance.

Learning path

The order to read in

Each course builds on the one before it. Skip what you know and start where you need to.

  1. 1

    JavaScript

    From variables to async/await and the DOM, a solid foundation in the language.

    47 chapters
  2. 2

    React.js

    Build interactive UI with components, state and hooks.

    37 chapters
  3. 3

    Next.js

    A full app with routing, server components, data and deployment.

    34 chapters
  4. 4

    Best Practices

    Clean code, security, testing and team workflow, ready for production.

    57 chapters

Why ZnPedia

Easy to learn, useful to keep

One clear path instead of scattered tutorials, built on today's tools.

Two languages, same depth

Read every chapter in Roman Urdu or English. Technical terms stay in English, the words you will see in docs and at work.

One topic, one short chapter

Each chapter explains exactly one thing in 5 to 10 minutes. No long videos or scattered notes.

Modern and current

React 19.2, the Next.js 16 App Router, Cache Components and today's JavaScript. Old approaches appear only for comparison.

Production-grade habits

The Best Practices course shows how teams write, review and ship code, and why.

A clear learning path

One order from JavaScript to Next.js. Every chapter tells you what to read before and after.

Free, no sign-up

No accounts, paywalls or ads. Open a page and start reading.

FAQ

Frequently asked questions

Have another question? The About page explains everything about ZnPedia.

Is ZnPedia really free?

Yes. Every course and chapter is free. No sign-up, subscription or ads.

Where should I start?

If programming is new to you, start with the JavaScript Introduction. If you already know React or Next.js, go straight to the Best Practices course.

Why is there a Roman Urdu version?

New concepts click faster in your own language. ZnPedia started in Roman Urdu, and every chapter is now available in English too.

Can I switch languages?

Yes. Use the language switcher in the header. Every chapter exists in both languages, each with its own URL.

How long does a chapter take?

Most chapters take 4 to 10 minutes to read, plus time to run the code yourself. Every page shows its reading time at the top.

Who is the Best Practices course for?

Developers who know the basics and now want to write, review and ship production-grade code.

One chapter today, another tomorrow

Fifteen minutes a day is enough. Open the first chapter and see how the structure helps.