title: Dividing an array by filter function
body: <p>I have a Javascript array that I would like to split into two based on whether a function called on each element returns <code>true</code> or <code>false</code>. Essentially, this is an <code>array.filter</code>, but I'd like to also have on hand the elements that were filtered <em>out</em>.</p>
  
  <p>Currently, my plan is to use <code>array.forEach</code> and call the predicate function on each element. Depending on whether this is true or false, I will push the current element onto one of the two new arrays. Is there a more elegant or otherwise better way to do this? An <code>array.filter</code> where the will push the element onto another array before it returns <code>false</code>, for instance?</p>