title: How to place the results of an if statement into a new array which I can return later
body: <p>I'm fairly new to code and I've been stuck on one particular problem for quite some time. I feel I have a good grasp on what's needed for the problem, but can't figure out for the life of me how to return the results of a if statement into a new array which I can then return. Any help or advice would be greatly appreciated.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function loveTheThrees (myArray) {
  
  var myTotal = 0;
  
  for (var i = 0; i &lt; myArray.length; i++) {
    if (myArray[i] % 3 === 0) {
      myTotal += myArray[i];
      /* What I'm looking to do at this stage of the problem is place the results into a new array which will be returned rather than myTotal */
  }
  }
  
  return myTotal; // Placed this here just to test to see if the problem would post the results
  }
  
  loveTheThrees ([1, 3, 5, 12, 21]);</code></pre>
  </div>
  </div>
  </p>