title: How do I convert every string in split array to a number?
body: <p>I have a string that needs to be split and converted into numbers. I decided to split the string and put the strings into an array and later convert them into numbers using the <code>Array.prototype.every()</code> function and the <code>Number()</code> function. </p>
  
  <p>When I check the type of the first array element, I see that I still have a string and not a number. Where is my mistake? The answer <a href="https://stackoverflow.com/questions/10286386/how-to-convert-string-equation-to-number-in-javascript">here</a> makes it look like after splitting JS would convert to number automatically but that isn't happening as evidenced by logging the type of the first element. </p>
  
  <pre><code>function detectOutlierValue(string) {
      // convert string into array with numbers, 'separator " "
      var numArray = string.split(' ');
      console.log(typeof numArray[0]);
      console.log(numArray);
  
      numArray.every(function (item) {
          return Number(item);
      });
      console.log(numArray, typeof numArray[0]);
  </code></pre>
  
  <p>My output is:</p>
  
  <pre><code>string
  [ '2', '4', '7', '8', '10' ]
  [ '2', '4', '7', '8', '10' ] 'string'
  </code></pre>