title: trying to find Prime numbers in an array
body: <p>I'm wanting to remove the non-prime numbers from an Array, the following is only removing the even numbers instead of the prime numbers. </p>
  
  <pre><code>function sumPrimes(num) {
    //Produce an array containing all number of to and including num
    let numArray = [];
    for (let i = 1; i &lt;= num; i++) {
      numArray.push(i);
    }
  
    //Remove non-prime numbers from the array     
    numArray.map((number) =&gt; {
      for (let i = 2; i &lt; number; i++) {
          if(number % i === 0) {
              let index = numArray.indexOf(number);
              return numArray.splice(index, 1);       
          }
      }   
    });
  
   return numArray;
  
  }
  
  sumPrimes(10);
  </code></pre>
  
  <p>This is currently returning:</p>
  
  <pre><code>[1, 2, 3, 5, 7, 9]
  </code></pre>
  
  <p>However, prime numbers are 1, 2, 3, 5, 7 (not include 9);</p>