/*** Definition for singly-linked list.* function ListNode(val) {* this.val = val;* this.next = null;* }*//*** @param {ListNode} head* @return {ListNode}*/var reverseList = function(head) {let cur = null,tail = nullwhile(head !== null) {tail = headhead = head.nexttail.next = curcur = tail}return tail};
