/*function ListNode(x){
this.val = x;
this.next = null;
}*/
function printListFromTailToHead(head)
{
// write code here
var arr = [];
if(head == null){
return arr;
}
while(head != null){
arr.push(head.val);
head = head.next;
}
return arr.reverse();
}
原文:https://www.cnblogs.com/3yleaves/p/9588575.html