Insert a node at the head of a linked list

  • + 0 comments

    Javasctipt solution

    const node = new SinglyLinkedListNode(data);
        
     if (!head) return head = node;
        
     node.next = head;
     return head = node;