set.values().forEach(set.delete, set);

+1 on clear(), a shortcut would be nice

On Wed, Feb 15, 2012 at 6:40 AM, Peter Michaux <[email protected]>wrote:

> If some piece of code needs to empty a set, it would be good to do
> that in a single call
>
>    set.empty();
>
> Otherwise we might be left doing the following which could be very
> inefficient.
>
>    set.forEach(function(element) {
>        set['delete'](element);
>    });
>
> Peter
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to