Linked List implementation in Javascript