Javascript LinkedList implementation