🧱 1. What is a Linked List? A Linked List is a linear data structure where elements are stored in nodes , and each node points to the next. [value | next] → [value | next] → [value | null] Enter fullscreen mode Exit fullscreen mode 👉 Last node always points to null 🔧 2. Node Structure function Node ( value ) { this . data = value ; this . next = null ; } Enter fullscreen mode Exit fullscreen mode 🏗️ 3. Linked List Class var MyLinkedList = function () { this . head = null ; this . len = 0 ; // MUST be 0 }; Enter fullscreen mode Exit fullscreen mode ⚠️ IMPORTANT RULES (DO NOT IGNORE) Always use 0-based indexing Always update len Never break pointer chain Always check invalid index 📌 4. Add At Head 🖼️ Visualization 💡 Idea New node becomes the first node. 🪜 Steps Create new node Point it to current head Move head to new node ✅ Code MyLinkedList . prototype . addAtHead = function ( val ) { const node = new Node ( val ); node . next = this . head ; this . head = node ; this .…