/*function ListNode(x){
this.val = x;
this.next = null;
}*/
function ReverseList(pHead)
{
// write code here
let prev=null
let curr=pHead
while(curr){
//运用es6解构赋值,一一对应,不需要考虑赋值顺序,不需要定义额外next
[curr.next,prev,curr]=[prev,curr,curr.next]
}
return prev
}
module.exports = {
ReverseList : ReverseList
};