The some method, as currently implemented, isn't truly better.
Mathematically, I think Array.prototype.some would be equivalent to my
suggested Array.prototype.filter(callback, thisObj, 1);

On Tue, Nov 13, 2012 at 12:33 PM, Brendan Eich <[email protected]> wrote:

> 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
>
>


-- 
"The first step in confirming there is a bug in someone else's work is
confirming there are no bugs in your own."
-- Alexander J. Vincent, June 30, 2001
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to