Doubly LinkedList Node is constructed of the following items
- A class named node
- A class constructor, and
- Data items/variables
- data: to contain respective node value
- next: to link the next node with the default value as null.
- prev: to link the previous node with the default value as null.
Example:
Javascript
// Doubly Linked list Node class Node { // Constructor to create a new node // next and prev is by default initialized as null constructor(val) { // To store the value this .data = val; // To link the next Node this .next = null ; // TO link the previous Node this .prev = null ; } } |
Implementation of Doubly Linked List in JavaScript
This article will demonstrate the Implementation of Doubly Linked List In JavaScript.
A doubly linked list (DLL) is a special type of linked list in which each node contains a pointer to the previous node as well as the next node of the linked list.