1. /**
    2. * Definition for singly-linked list.
    3. * function ListNode(val) {
    4. * this.val = val;
    5. * this.next = null;
    6. * }
    7. */
    8. /**
    9. * @param {ListNode} head
    10. * @return {number[]}
    11. */
    12. var reversePrint = function(head) {
    13. const res = []
    14. while(head) {
    15. res.unshift(head.val)
    16. head = head.next
    17. }
    18. return res
    19. };