Print the Elements of a Linked List

  • + 0 comments

    JavaScript (Node.js)

    function printLinkedList(head) {
        while (head) {
            console.log(head.data);
            head = head.next;
        }
    }