how to reverse a linked list javascript iteratively