Linked list in JavaScript