Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- prepend(): Prepend a new Node Object to the beginning of the LinkedList
- */
- LinkedList.prototype.prepend = function(data) {
- let newNode = new Node(data);
- newNode.next = this.head;
- this.head = newNode;
- }
Add Comment
Please, Sign In to add comment