Concrete implementation of a doubly linked list node.

Provides bidirectional node linking capabilities.

// Create nodes and link them
const node1 = new DoublyLinkedListNode();
const node2 = new DoublyLinkedListNode();
const node3 = new DoublyLinkedListNode();

// Connect nodes bidirectionally
node1.next = node2;
node2.previous = node1;
node2.next = node3;
node3.previous = node2;

Hierarchy (View Summary)

Implements

Constructors

Properties

Methods

Constructors

Properties

next: null | DoublyLinkedListNode = null

The next node, or null if the node has no next connection.

previous: null | DoublyLinkedListNode = null

The previous node, or null if the node has no previous connection.

Methods

  • Detaches the node from its adjacent nodes and sets its pointers to null. Updates the connections of adjacent nodes to maintain list integrity.

    Returns void

    // Create a chain of nodes
    const node1 = new DoublyLinkedListNode();
    const node2 = new DoublyLinkedListNode(node1);
    const node3 = new DoublyLinkedListNode(node2);

    // Detach node2 from the chain
    node2.detach();
    // Result:
    // node1 <-> node3
    // node2.previous === null
    // node2.next === null