Guest User

Untitled

a guest
Aug 10th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. /*getMiddleElement() {
  2. let node = this.head;
  3. let count = 1;
  4. const half = Math.floor(this.length / 2);
  5. while (node) {
  6. if (count === half) return `${node.value} is the middle element!`;
  7. count++;
  8. node = node.next;
  9. }
  10.  
  11. return node;
  12. } */
Add Comment
Please, Sign In to add comment