Inserts a new node to a specific index in the list if no index is provided it adds the node to the end of the list
self reference
const list = new DoublyLinkedList<string>(['john', 'sami']);
list.insert('joe', 0).insert('gaafar', 1) // ['joe', 'gaafar', 'john', 'sami']
Optional
pos: numberdeletes the last node from the list
self reference
const list = new DoublyLinkedList<number>([1,2,3,4,5]);
list.pop().pop() // [1,2,3]
deletes the first node from the list
self reference
const list = new DoublyLinkedList<number>([1,2,3,4,5]);
list.popStart().popStart() // [3,4,5]
Inserts a new node to the end of the list
self reference
const list = new DoublyLinkedList<string>(['john', 'sami']);
list.push('joe') // ['john', 'sami', 'joe']
Inserts a new node to the beggining of the list
self reference
const list = new DoublyLinkedList<string>(['john', 'sami']);
list.pushStart('joe'); // ['joe,', 'john', 'sami']
logs the list in the console
self reference
const list = new DoublyLinkedList<number>([1,2,3,4,5]);
list.view()
Generated using TypeDoc
deletes a node from the list
Returns
self reference
Example