The Odin Project - Linked List Assignment
All the magic is in the console.
Create a new LinkedList with
new LinkedList([val1, val2, val3, ...])`
or use one of the premade LinkedLists
window.llA = new LinkedList([0,1,2,3,4,5,7,8,9]);
window.llB = new LinkedList([1,4,6,7,9,124,509,1025,1403]);
Interact with a LinkedList via the following methods:
- append(val) - Append `val` to the tail of the list
- prepend(val) - Prepend `val` to the head of the list
- size - returns the size of the list
- head - returns the node at the head of the list
- tail - returns the node at the tail of the list
- at(index) - returns the node at `index`
- pop - removes the node at the tail of the list
- contains(value) - returns true if the list contains the value
- find(value) - returns the index of the value if it is in the list
- toString - returns the full list in the form "( value ) -> ( value ) -> ... -> null"