this method is to enter a linked list and then print the linked list from end to end
function ListNode(x){
this.val = x;
this.next = null;
}
function printListFromTailToHead(head)
{
// write code here
var arr = [];
while(head != null) {
// var a = head.val;
// console.log(a);
arr.unshift(head.val);
head = head.next;
}
return arr;
}
1
2printListFromTailToHead(1,2,3)