javascript

JavaScript

# 🟨 JavaScript β€” Complete Topics List (Zero Chhoot, Zero Mercy)

πŸ“Œ Ek ek topic padh, ek ek samajh. Skip kiya toh pachtayega!


# πŸ“¦ SECTION 1 β€” Fundamentals (Basics ki Jad)

# 1.1 Introduction

  • What is JavaScript?
  • History & Evolution (ES5 β†’ ES6+ β†’ ESNext)
  • How JS runs in Browser vs Node.js
  • JS Engine (V8, SpiderMonkey) & Runtime
  • Call Stack, Heap Memory
  • Single-threaded nature of JS

# 1.2 Script Setup

  • <script> tag β€” inline vs external
  • defer and async attributes
  • Browser Console & DevTools

# πŸ”€ SECTION 2 β€” Variables & Data Types

# 2.1 Variable Declarations

  • var β€” function scoped, hoisted
  • let β€” block scoped
  • const β€” block scoped, immutable binding
  • Differences & Best Practices
  • Temporal Dead Zone (TDZ)

# 2.2 Data Types

  • Primitives:
    • Number (including NaN, Infinity)
    • String
    • Boolean
    • undefined
    • null
    • Symbol (ES6)
    • BigInt (ES2020)
  • Non-Primitives (Reference Types):
    • Object
    • Array
    • Function

# 2.3 Type System

  • typeof operator
  • Type Coercion (Implicit vs Explicit)
  • == vs ===
  • Truthy & Falsy values
  • null vs undefined vs NaN

# πŸ”’ SECTION 3 β€” Operators

  • Arithmetic Operators (+, -, *, /, %, **)
  • Assignment Operators (=, +=, -=, etc.)
  • Comparison Operators (==, !=, ===, !==, >, <, >=, <=)
  • Logical Operators (&&, ||, !)
  • Nullish Coalescing (??)
  • Optional Chaining (?.)
  • Ternary Operator (condition ? a : b)
  • Bitwise Operators (&, |, ^, ~, <<, >>, >>>)
  • Comma Operator
  • in operator
  • instanceof operator
  • Spread (...) and Rest (...) operators
  • void operator
  • delete operator
  • typeof operator

# πŸ” SECTION 4 β€” Control Flow

# 4.1 Conditionals

  • if, else if, else
  • switch statement
  • Guard Clauses Pattern

# 4.2 Loops

  • for loop
  • while loop
  • do...while loop
  • for...in loop (object keys)
  • for...of loop (iterables)
  • break and continue
  • Labeled Statements

# 🧩 SECTION 5 β€” Functions

# 5.1 Types of Functions

  • Function Declaration
  • Function Expression
  • Arrow Functions (=>)
  • Anonymous Functions
  • Named Function Expressions
  • IIFE (Immediately Invoked Function Expression)
  • Generator Functions (function*)
  • Async Functions (async function)

# 5.2 Function Concepts

  • Parameters vs Arguments
  • Default Parameters
  • Rest Parameters (...args)
  • Arguments Object
  • Return Values
  • First-Class Functions
  • Higher-Order Functions
  • Pure Functions
  • Function Composition

# 5.3 Advanced Function Topics

  • Closures
  • Lexical Scope
  • Scope Chain
  • this keyword
  • call(), apply(), bind()
  • Currying
  • Memoization
  • Recursion
  • Tail Call Optimization

# πŸ—οΈ SECTION 6 β€” Scope & Hoisting

  • Global Scope
  • Function Scope
  • Block Scope
  • Lexical Scope
  • Scope Chain
  • Variable Hoisting (var)
  • Function Hoisting
  • Temporal Dead Zone (let, const)
  • Module Scope

# 🧠 SECTION 7 β€” Objects

# 7.1 Object Basics

  • Object Literals
  • Property Access (dot vs bracket notation)
  • Property Shorthand (ES6)
  • Computed Property Names
  • Property Descriptors (writable, enumerable, configurable)
  • Object.defineProperty()

# 7.2 Object Methods (Built-in)

  • Object.keys(), Object.values(), Object.entries()
  • Object.assign()
  • Object.freeze(), Object.seal()
  • Object.create()
  • Object.getPrototypeOf()
  • Object.fromEntries()
  • hasOwnProperty()

# 7.3 Advanced Object Concepts

  • Prototype & Prototype Chain
  • __proto__ vs prototype
  • Prototypal Inheritance
  • Object Destructuring
  • Spread in Objects (...)
  • Getter & Setter (get, set)
  • Symbol as Object Key
  • Proxy & Reflect (ES6)

# πŸ“š SECTION 8 β€” Arrays

# 8.1 Array Basics

  • Array Creation (literal, Array(), Array.from(), Array.of())
  • Indexing & Length
  • Multidimensional Arrays

# 8.2 Array Methods β€” Mutating

  • push(), pop()
  • shift(), unshift()
  • splice()
  • reverse()
  • sort()
  • fill()
  • copyWithin()

# 8.3 Array Methods β€” Non-Mutating

  • slice()
  • concat()
  • join()
  • indexOf(), lastIndexOf()
  • includes()
  • find(), findIndex()
  • flat(), flatMap()
  • toString()

# 8.4 Higher-Order Array Methods

  • map()
  • filter()
  • reduce(), reduceRight()
  • forEach()
  • every(), some()

# 8.5 Static Array Methods

  • Array.isArray()
  • Array.from()
  • Array.of()

# 8.6 Array Destructuring

  • Basic Destructuring
  • Skipping Elements
  • Rest in Destructuring
  • Swap Variables

# 🧡 SECTION 9 β€” Strings

# 9.1 String Basics

  • String Creation (literal, String(), backticks)
  • Immutability of Strings
  • String Indexing
  • length property

# 9.2 Template Literals

  • Interpolation (${})
  • Multiline Strings
  • Tagged Templates

# 9.3 String Methods

  • charAt(), charCodeAt()
  • indexOf(), lastIndexOf()
  • includes(), startsWith(), endsWith()
  • slice(), substring(), substr() (deprecated)
  • toUpperCase(), toLowerCase()
  • trim(), trimStart(), trimEnd()
  • padStart(), padEnd()
  • repeat()
  • replace(), replaceAll()
  • split()
  • match(), matchAll()
  • search()
  • at()
  • String.fromCharCode()
  • normalize()

# πŸ”’ SECTION 10 β€” Numbers & Math

# 10.1 Number

  • Number() conversion
  • parseInt(), parseFloat()
  • isNaN(), Number.isNaN()
  • isFinite(), Number.isFinite()
  • isInteger(), isSafeInteger()
  • toFixed(), toPrecision(), toString()
  • Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER
  • Number.EPSILON
  • Infinity, -Infinity
  • NaN behavior
  • Binary (0b), Octal (0o), Hex (0x) literals

# 10.2 Math Object

  • Math.abs(), Math.ceil(), Math.floor(), Math.round()
  • Math.max(), Math.min()
  • Math.pow(), Math.sqrt(), Math.cbrt()
  • Math.random()
  • Math.trunc(), Math.sign()
  • Math.log(), Math.log2(), Math.log10()
  • Math.PI, Math.E
  • Math.sin(), Math.cos(), Math.tan()

# 10.3 BigInt

  • BigInt literals (42n)
  • BigInt operations
  • Limitations of BigInt

# πŸ“… SECTION 11 β€” Date & Time

  • new Date()
  • Date Methods: getFullYear(), getMonth(), getDate(), getDay()
  • getTime(), Date.now()
  • setFullYear(), setMonth(), etc.
  • toISOString(), toLocaleDateString(), toLocaleTimeString()
  • Date Arithmetic
  • Timezone concepts
  • Libraries: date-fns, Day.js, Luxon (mention only)

# β™ŸοΈ SECTION 12 β€” Regular Expressions (Regex)

  • Regex Syntax (/pattern/flags)
  • Flags: g, i, m, s, u, y
  • Character Classes (\d, \w, \s, [a-z], etc.)
  • Anchors (^, $, \b)
  • Quantifiers (*, +, ?, {n}, {n,m})
  • Groups: Capturing (), Non-capturing (?:), Named (?<name>)
  • Lookaheads & Lookbehinds
  • Backreferences
  • Methods: test(), exec(), match(), matchAll(), replace(), search(), split()

# ⚑ SECTION 13 β€” Error Handling

  • try...catch...finally
  • throw statement
  • Error Types: Error, TypeError, ReferenceError, SyntaxError, RangeError, URIError, EvalError
  • Custom Error Classes
  • Error Properties: message, name, stack
  • Async Error Handling
  • Global Error Handling: window.onerror, unhandledrejection

# πŸ”„ SECTION 14 β€” Asynchronous JavaScript (Most Important!)

# 14.1 Concurrency Model

  • JS Event Loop (Deep Dive)
  • Call Stack
  • Web APIs
  • Callback Queue (Macrotask Queue)
  • Microtask Queue
  • Task Prioritization

# 14.2 Callbacks

  • Callback Pattern
  • Callback Hell / Pyramid of Doom
  • Error-first Callbacks (Node.js style)

# 14.3 Promises

  • Creating Promises (new Promise())
  • .then(), .catch(), .finally()
  • Promise States: Pending, Fulfilled, Rejected
  • Promise Chaining
  • Promise.all()
  • Promise.allSettled()
  • Promise.race()
  • Promise.any()
  • Promise.resolve(), Promise.reject()

# 14.4 Async/Await

  • async function
  • await keyword
  • Error handling with try/catch
  • Sequential vs Parallel execution
  • await with Promise.all()
  • Top-level await (ES2022)

# 14.5 Timers

  • setTimeout(), clearTimeout()
  • setInterval(), clearInterval()
  • queueMicrotask()
  • requestAnimationFrame()
  • setImmediate() (Node.js)
  • process.nextTick() (Node.js)

# 🌐 SECTION 15 β€” Web APIs (Browser JS)

# 15.1 DOM (Document Object Model)

  • DOM Tree Structure
  • document object
  • Selecting Elements:
    • getElementById(), getElementsByClassName(), getElementsByTagName()
    • querySelector(), querySelectorAll()
  • Traversing DOM:
    • parentNode, parentElement
    • childNodes, children
    • firstChild, lastChild, firstElementChild, lastElementChild
    • nextSibling, previousSibling, nextElementSibling, previousElementSibling
  • Manipulating DOM:
    • innerHTML, textContent, innerText
    • createElement(), createTextNode()
    • appendChild(), insertBefore(), append(), prepend()
    • insertAdjacentHTML(), insertAdjacentElement()
    • removeChild(), remove()
    • replaceChild(), replaceWith()
    • cloneNode()
  • Attributes: getAttribute(), setAttribute(), removeAttribute(), hasAttribute()
  • dataset (data attributes)
  • classList: add(), remove(), toggle(), contains(), replace()
  • Inline Styles: element.style
  • getComputedStyle()

# 15.2 Events

  • Event Listeners: addEventListener(), removeEventListener()
  • Event Object Properties: target, currentTarget, type, preventDefault(), stopPropagation(), stopImmediatePropagation()
  • Event Bubbling & Capturing
  • Event Delegation
  • Common Events:
    • Mouse: click, dblclick, mousedown, mouseup, mousemove, mouseenter, mouseleave, mouseover, mouseout, contextmenu
    • Keyboard: keydown, keyup, keypress
    • Form: submit, change, input, focus, blur, reset
    • Window: load, DOMContentLoaded, resize, scroll, unload, beforeunload
    • Drag: dragstart, drag, dragend, dragover, drop, dragenter, dragleave
    • Touch: touchstart, touchmove, touchend
    • Clipboard: copy, cut, paste
  • Custom Events (CustomEvent)
  • once, capture, passive options

# 15.3 BOM (Browser Object Model)

  • window object
  • navigator object (userAgent, geolocation, etc.)
  • location object (href, reload, replace, assign)
  • history object (back, forward, pushState, replaceState)
  • screen object
  • alert(), confirm(), prompt()
  • scrollTo(), scrollBy()
  • open(), close()

# 15.4 Storage

  • localStorage (persistent)
  • sessionStorage (session-based)
  • cookies (document.cookie)
  • IndexedDB (client-side DB)
  • Cache API

# 15.5 Fetch API & AJAX

  • XMLHttpRequest (legacy AJAX)
  • fetch() API
  • Request & Response Objects
  • Headers
  • HTTP Methods: GET, POST, PUT, PATCH, DELETE
  • Handling JSON
  • AbortController (cancel fetch)
  • CORS (Cross-Origin Resource Sharing)

# 15.6 Other Web APIs

  • Geolocation API
  • Notification API
  • Clipboard API
  • File API & FileReader
  • Canvas API
  • WebSockets
  • Server-Sent Events (SSE)
  • Web Workers
  • Service Workers & PWA
  • IntersectionObserver
  • MutationObserver
  • ResizeObserver
  • Broadcast Channel API
  • Crypto API (crypto.randomUUID())

# 🧱 SECTION 16 β€” Object-Oriented Programming (OOP)

# 16.1 Constructor Functions

  • new keyword
  • Constructor Pattern
  • instanceof check

# 16.2 Prototype-based Inheritance

  • prototype property
  • Prototype Chain
  • Inheriting methods via prototype

# 16.3 ES6 Classes

  • class keyword
  • constructor()
  • Instance Methods
  • Static Methods & Properties (static)
  • Getters & Setters
  • extends (Inheritance)
  • super keyword
  • Method Overriding
  • Private Fields (#field)
  • Private Methods
  • Abstract Class Pattern

# 16.4 OOP Principles in JS

  • Encapsulation
  • Abstraction
  • Inheritance
  • Polymorphism

# 🧬 SECTION 17 β€” Functional Programming (FP)

  • Pure Functions
  • Immutability
  • Function Composition (compose, pipe)
  • Higher-Order Functions
  • Currying & Partial Application
  • Functors & Monads (basic concept)
  • map, filter, reduce as FP pillars
  • Avoiding Side Effects
  • Declarative vs Imperative style

# πŸ“¦ SECTION 18 β€” ES6+ Modern JavaScript Features

# ES6 (2015)

  • let, const
  • Arrow Functions
  • Template Literals
  • Destructuring (Array & Object)
  • Default Parameters
  • Rest & Spread Operators
  • Classes
  • Modules (import / export)
  • Promises
  • Symbols
  • Iterators & Iterables ([Symbol.iterator])
  • Generators (function*, yield)
  • Map and Set
  • WeakMap and WeakSet
  • Proxy and Reflect
  • for...of loop
  • Computed Property Names

# ES2017 (ES8)

  • async / await
  • Object.entries(), Object.values()
  • String.prototype.padStart(), padEnd()
  • Trailing commas in function params

# ES2018 (ES9)

  • Async Iteration (for await...of)
  • Promise.finally()
  • Object Rest/Spread
  • Regex improvements

# ES2019 (ES10)

  • Array.prototype.flat(), flatMap()
  • Object.fromEntries()
  • String.prototype.trimStart(), trimEnd()
  • Optional catch binding

# ES2020 (ES11)

  • BigInt
  • Promise.allSettled()
  • String.prototype.matchAll()
  • Optional Chaining (?.)
  • Nullish Coalescing (??)
  • globalThis
  • Dynamic Import (import())

# ES2021 (ES12)

  • String.prototype.replaceAll()
  • Promise.any()
  • Logical Assignment Operators (&&=, ||=, ??=)
  • WeakRef & FinalizationRegistry
  • Numeric Separators (1_000_000)

# ES2022 (ES13)

  • Class Fields (Public & Private)
  • Static Class Fields & Methods
  • Top-level await
  • Array.prototype.at()
  • Object.hasOwn()
  • Error.cause
  • /.d flag for Regex

# ES2023 (ES14)

  • Array.prototype.toSorted(), toReversed(), toSpliced(), with()
  • findLast(), findLastIndex()
  • Hashbang Grammar

# ES2024 (ES15)

  • Promise.withResolvers()
  • Object.groupBy(), Map.groupBy()
  • ArrayBuffer.prototype.resize()
  • RegExp v flag

# πŸ—‚οΈ SECTION 19 β€” Modules

  • CommonJS (require, module.exports) β€” Node.js
  • ES Modules (import, export) β€” Modern Standard
  • Named vs Default exports
  • export * from
  • Dynamic Imports (import())
  • Module Bundlers: Webpack, Vite, Rollup, esbuild
  • Tree Shaking
  • Circular Dependencies

# πŸ” SECTION 20 β€” Iterators & Generators

  • Iterator Protocol (next(), value, done)
  • Iterable Protocol ([Symbol.iterator])
  • Custom Iterables
  • Generator Functions (function*)
  • yield & yield*
  • Infinite Sequences
  • return() and throw() on generators
  • Async Generators (async function*)
  • for await...of with async generators

# πŸ—ΊοΈ SECTION 21 β€” Map, Set, WeakMap, WeakSet

# Map

  • new Map()
  • set(), get(), has(), delete(), clear()
  • size property
  • Iterating Map (forEach, for...of, .keys(), .values(), .entries())
  • Map vs Object differences

# Set

  • new Set()
  • add(), has(), delete(), clear()
  • size property
  • Iterating Set
  • Set for deduplication
  • Set operations (Union, Intersection, Difference)

# WeakMap & WeakSet

  • Weak references
  • No iteration
  • Use cases (private data, caching)
  • Garbage collection behavior

# 🧡 SECTION 22 β€” Symbol

  • Symbol() β€” unique primitives
  • Symbol.for() & Symbol.keyFor()
  • Well-known Symbols:
    • Symbol.iterator
    • Symbol.toPrimitive
    • Symbol.toStringTag
    • Symbol.hasInstance
    • Symbol.asyncIterator
    • Symbol.species
  • Symbols as private object keys

# πŸ›‘οΈ SECTION 23 β€” Proxy & Reflect

# Proxy

  • new Proxy(target, handler)
  • Traps: get, set, has, deleteProperty, apply, construct, ownKeys, etc.
  • Use cases: validation, logging, reactive data

# Reflect

  • Reflect.get(), Reflect.set(), Reflect.has(), etc.
  • Reflect as complement to Proxy

# πŸ”’ SECTION 24 β€” Memory Management & Performance

  • Garbage Collection (Mark & Sweep)
  • Memory Leaks (causes & prevention)
  • WeakRef & FinalizationRegistry
  • Object Pooling
  • Debouncing & Throttling
  • Lazy Loading
  • Code Splitting
  • requestAnimationFrame for animations
  • requestIdleCallback
  • Profiling with DevTools

# πŸ§ͺ SECTION 25 β€” Testing in JavaScript

  • Unit Testing, Integration Testing, E2E Testing
  • Test Runners: Jest, Vitest, Mocha
  • Assertion Libraries: Chai, built-in assert
  • Mocking: jest.fn(), jest.mock()
  • Spies & Stubs
  • Testing Library (for DOM testing)
  • Cypress / Playwright (E2E)
  • Code Coverage
  • TDD (Test-Driven Development)

# πŸ›οΈ SECTION 26 β€” Design Patterns in JavaScript

# Creational Patterns

  • Factory Pattern
  • Constructor Pattern
  • Singleton Pattern
  • Prototype Pattern
  • Builder Pattern

# Structural Patterns

  • Module Pattern
  • Revealing Module Pattern
  • Decorator Pattern
  • Facade Pattern
  • Adapter Pattern
  • Mixin Pattern

# Behavioral Patterns

  • Observer Pattern / Pub-Sub
  • Command Pattern
  • Strategy Pattern
  • Iterator Pattern
  • Mediator Pattern
  • Chain of Responsibility

# πŸ–₯️ SECTION 27 β€” Node.js Specific (Backend JS)

  • Node.js Architecture & Event Loop differences
  • process object
  • Buffer and Streams
  • File System (fs module)
  • Path module (path)
  • HTTP module
  • EventEmitter
  • Modules: CommonJS vs ESM
  • NPM / PNPM / Yarn
  • package.json & package-lock.json
  • Environment Variables (.env, dotenv)
  • Child Processes
  • Cluster module
  • Worker Threads
  • REPL

# πŸ” SECTION 28 β€” Security in JavaScript

  • XSS (Cross-Site Scripting) β€” prevention
  • CSRF (Cross-Site Request Forgery) β€” prevention
  • Content Security Policy (CSP)
  • eval() β€” dangers
  • Prototype Pollution
  • Sanitizing user input
  • CORS security
  • Secure cookies (HttpOnly, Secure, SameSite)
  • JWT basics
  • HTTPS

# 🧰 SECTION 29 β€” Tools & Ecosystem

# Code Quality

  • ESLint (linting)
  • Prettier (formatting)
  • Husky + lint-staged (pre-commit hooks)
  • TypeScript (static typing)

# Build Tools

  • Webpack
  • Vite
  • Rollup
  • esbuild
  • Parcel
  • Babel (transpiling)

# Package Managers

  • npm
  • yarn
  • pnpm

# Version Control

  • Git basics (not JS but must-know)

# Runtime Environments

  • Browser
  • Node.js
  • Deno
  • Bun

# πŸ“Š SECTION 30 β€” TypeScript (Extension of JS)

  • Why TypeScript?
  • Basic Types: string, number, boolean, any, unknown, never, void
  • Type Annotations & Type Inference
  • Interfaces vs Types
  • Generics
  • Union & Intersection Types
  • Enums
  • Tuple Types
  • Optional & Readonly Properties
  • Type Narrowing & Guards
  • Utility Types: Partial, Required, Readonly, Record, Pick, Omit, Exclude, Extract, ReturnType, Parameters
  • tsconfig.json
  • Declaration Files (.d.ts)
  • Decorators (experimental)

# 🧠 SECTION 31 β€” Deep Dive / Internals

  • JS Engine Internals (Parsing, AST, Bytecode, JIT)
  • V8 Optimization (Hidden Classes, Inline Caching)
  • Execution Context & Execution Context Stack
  • Variable Environment vs Lexical Environment
  • this binding rules:
    • Default binding
    • Implicit binding
    • Explicit binding
    • new binding
    • Arrow function (no this)
  • arguments object vs rest params
  • Strict Mode ("use strict")
  • Tail Call Optimization (TCO)
  • Coercion internals (ToPrimitive, ToString, ToNumber, ToBoolean)

# 🌍 SECTION 32 β€” Internationalization (i18n)

  • Intl object
  • Intl.NumberFormat
  • Intl.DateTimeFormat
  • Intl.Collator
  • Intl.PluralRules
  • Intl.RelativeTimeFormat
  • Intl.Segmenter

# ✨ SECTION 33 β€” Miscellaneous (Chhota Par Zaroori)

  • JSON: JSON.parse(), JSON.stringify(), replacer, reviver, spacing
  • structuredClone() (deep copy)
  • Shallow vs Deep Copy
  • Object.assign() vs spread for copy
  • Serialization / Deserialization
  • eval() (why to avoid)
  • with statement (deprecated, don't use)
  • Comma operator
  • Labeled statements
  • void operator
  • typeof null === "object" bug (historical)
  • NaN !== NaN quirk
  • 0 === -0 but Object.is(0, -0) is false

# 🎯 SECTION 34 β€” Interview Prep Topics

  • Polyfills: map, filter, reduce, bind, call, apply, Promise, flat
  • Output-based questions (type coercion, hoisting, closures)
  • Event Loop output questions
  • this binding tricky questions
  • Closure interview questions
  • Debounce & Throttle implementation
  • Deep clone implementation
  • Currying implementation
  • Compose/Pipe implementation
  • Infinite currying (add(1)(2)(3)...)
  • Promises from scratch
  • Custom Promise.all()
  • LRU Cache in JS
  • Flatten nested array/object
  • Implement new operator
  • Implement instanceof
  • Memoization from scratch

πŸ”₯ Extra Gyan By Your Bhai:

Bhai sun, JS sikhna ek baar ki baat nahi hai. Yeh layered hai:

Layer 1 β†’ Syntax (Sections 1–13)
Layer 2 β†’ Async (Section 14 β€” sabse important, yahan log phaste hain)
Layer 3 β†’ Browser/Web APIs (Section 15)
Layer 4 β†’ OOP/FP (Sections 16–17)
Layer 5 β†’ Modern JS + Internals (Sections 18–33)
Layer 6 β†’ Ecosystem + TypeScript (Sections 29–30)

Sequence follow kar. Async ko skip mat karna sochke "baad mein kar lunga" β€” woh baad kabhi nahi aata. 😀

Aur haan β€” JavaScript padhna aur JavaScript likhna dono alag cheez hain. Code karta reh, sirf padhta mat reh. πŸ’»


Total Sections: 34 | Total Topics: 300+ | Koi topic nahi chhoda bhai 🫑

JavaScript | M.S.V. Codex