This is an implementation of a singly linked list written in JavaScript while applying Test-Driven Development (TDD).
The following methods are implemented:
append(value)
- adds a node with the given value to the end of the list.prepend(value)
- adds a node with the given value to the beginning of the list.getSize()
- returns the number of nodes in the list.getHead()
- returns the first node in the list.getTail()
- returns the last node in the list.at(index)
- returns the node at a given index.pop()
- removes the last node from the list.contains(value)
- returns a boolean indicating if a node is in the list or not.find(value)
- returns in the index of a node containing the given value, ornull
if one isn't found.toString()
- stringifies the Linked List.insertAt(value, index)
- inserts a new nodes with the provided value at the given index.removeAt(index)
- removes the node at the given index.reverse()
- reversing the Linked List.