Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- remove(val){
- if(this.head === null) {
- return -1;
- }
- else if(this.head.val === val) {
- this.head = this.head.next;
- return 1;
- }
- let read = this.head;
- while(read.next !== null){
- if(read.next.val === val){
- read.next = read.next.next;
- return 1;
- }
- }
- return -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement