Linkedlist translated to js