Guest User

Untitled

a guest
May 20th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. removeAt(index) {
  2. if (!this.head) {
  3. return;
  4. }
  5.  
  6. if (index === 0) {
  7. this.head = this.head.next
  8. return;
  9. }
  10.  
  11. const previous = this.getAt(index - 1)
  12. if (!previous || !previous.next) {
  13. return;
  14. }
  15. previous.next = previous.next.next
  16. }
Add Comment
Please, Sign In to add comment