Skip to content

bbscoding/Advanced-JavaScript

Repository files navigation

Advanced JavaScript Examples

This repository demonstrates core JavaScript concepts with practical examples:

  1. Lexical Scope & Closure

    • Functions can access variables from their parent scope.
    • Closures allow a function to "remember" these variables even after the parent scope is gone.
  2. IIFE (Immediately Invoked Function Expression)

    • Functions that run immediately after being defined.
    • Useful for creating private variables and avoiding global scope pollution.
  3. Closure with Parameters

    • Demonstrates how closures can manage dynamic values (like credits, counters, API limits).
    • Useful for state management and resource control.

🔥 New Topics Added

  1. Prototype Inheritance (prototype-inheritance.js)

    • Demonstrates how objects can inherit properties and methods from other objects using Object.setPrototypeOf.
    • Explains the differences between __proto__ and modern methods like getPrototypeOf and setPrototypeOf.
    • Shows how multiple objects can form a prototype chain.
  2. Getters & Setters (getters-setters.js)

    • Shows how to use get and set for encapsulating object properties.
    • Demonstrates property overriding and prototype chain behavior.
    • Compares Object.keys() vs for...in when iterating over properties.
  3. Object Constructors (object-constructors.js)

    • Uses constructor functions to create reusable object blueprints.
    • Adds shared methods via prototype to optimize memory usage.
    • Explains how instances access properties/methods through the prototype chain.
  4. ES6 Classes & Inheritance (classes-inheritance.js)

    • Demonstrates modern class-based syntax for inheritance.
    • Uses extends and super() to inherit properties and methods.
    • Compares class inheritance with traditional prototype-based inheritance.

📚 Further Reading


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published