Andrea Giammarchi wrote:
wait, I might have misunderstood your problem ... so you want to stop iterating, right ?

When that is the case, you can simply drop the iteration like this:

myArray.slice().filter(function (value, index, original) {
  // do your stuff
  if (conditionSatisfied) {
    original.length = 0;
  }
});

there, you can break the iteration as easy as that :-)

Making a copy and then mutating its length seems worse than using some, though.

/be

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to