Simple implementation of a doubly linked list in Javascript