法一:
递归
var reversePrint = function(head) {
if(head===null) return [];
let res=reversePrint(head.next)
res.push(head.val)
return res
};
法二
栈
var reversePrint = function(head) {
let arr=[]
if(head===null) return []
while(head){
arr.unshift(head.val)
head=head.next
}
return arr
};