• + 0 comments

    solution

    function reversePrint(llist) { // Write your code here if (llist === null) { return } else { // reverse the list let current = llist; let prev = null;

        while (current !== null) {
            let next = current.next;
            current.next = prev;
            prev = current;
            current = next;
        };
    
        //print the reverse list
        let reversed = prev;
        for (; reversed !== null; reversed = reversed.next) {
            console.log(reversed.data);
        };
    
    }
    

    }