Deal with predicates that modify the original array.

Allow filter to match Array.prototype.filter behavior when input array
is modified by the filter predicate.

Unit fails for 3.6.1. Passes as of 83f483f4a4fc51e9949577c006c491eb331a1664

Fix #400