Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function insert(head, data) {
- var newNode = new Node(data);
- var last = head;
- if(last === null) head = newNode;
- else {
- while(last.next !== null){
- last = last.next;
- }
- last.next = newNode;
- }
- return head;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement