title: What is the in-place alternative to Array.prototype.filter()
body: <p>I've got an array that I would like to remove some elements from. I can't use <code>Array.prototype.filter()</code>, because I want to modify the array in place (because it saves a memory allocation and, more important for me, makes the code more simple in my use case). Is there an in-place alternative to <code>filter</code> that I can use, maybe analogously to how <a href="https://stackoverflow.com/a/3034430/371137"><code>Array.prototype.forEach()</code> can be used as an in-place variant to <code>Array.prototype.map()</code></a>?</p>
  
  <p>Edit: Minimum example upon request:</p>
  
  <pre><code>function someCallback(array) {
    // do some stuff
    array.filterInPlace(function(elem) {
      var result = /* some logic */
      return result;
    })
    // do some more stuff
  }
  </code></pre>