title: return largest phone number in JS array
body: <p>I have to return the largest phone number,not index, from an array in Javascript. I am trying to remove the non digit characters then find largest number. I am new and not experienced with the syntax. Alot of examples show parts of my problem. I don't know how to connect them into one function and how to return the answer. Please help me out. Heres what I have:</p>
  
  <pre><code>function myFunction(array) {
      var largest = array.replace(/\D/g, '');
      for (var i = 0; i &lt; array.length; i++) {
          if (largest &lt; array[i]) {
              largest = array[i];
          }
      }
      console.log(largest);
  }
  
  myFunction([509 - 111 - 1111, 509 - 222 - 2222, 509 - 333 - 3333]);
  </code></pre>