doubly linked list implementation in javascript