Javascript loop an array to find numbers divisible by 3
<p>I am needing to find the correct way to have javascript loop through an array, find all numbers that are divisible by 3, and push those numbers into a new array.</p>

<p>Here is what I have so far..</p>

<pre><code>var array = [],
    threes = [];

function loveTheThrees(array) {
    for (i = 0, len = array.length; i &lt; len; i++) {
    threes = array.push(i % 3);
  }
  return threes;
}
</code></pre>

<p>So if we pass through an array of [1, 2, 3, 4, 5, 6] through the function, it would push out the numbers 3 and 6 into the "threes" array. Hopefully this makes sense.</p>