set.empty() method

Andrea Giammarchi andrea.giammarchi at gmail.com
Wed Feb 15 01:00:34 PST 2012


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 <petermichaux at gmail.com>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
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120215/b82fe8b0/attachment.html>


More information about the es-discuss mailing list