来用数组解链表题吧~

function ListNode(x){
    this.val = x;
    this.next = null;
}
function ReverseList(pHead)
{
    let dummy = new ListNode(0), res = [], cur = dummy
    while(pHead){
        res.push(pHead.val)
        pHead = pHead.next
    }
    cur = dummy
    while(res.length){
        cur.next = new ListNode(res.pop())
        cur = cur.next
    }
    cur.next = null
    return dummy.next
}
module.exports = {
    ReverseList : ReverseList
};