daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.   } */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top