Return value of mutation methods on collections

Tab Atkins Jr. jackalmage at gmail.com
Tue Sep 23 13:33:27 PDT 2014


On Tue, Sep 23, 2014 at 12:57 PM, Claude Pache <claude.pache at gmail.com> wrote:
> Hi,
>
> Currently, `(Weak)Map.prototype.set` and `(Weak)Set.prototype.add` are specified to return the collection on which the method is applied.
>
> It seems logical to extend that scheme to other mutation methods, namely `.delete()` and `.clear()`.

.delete() returns a bool for whether it deleted something; it's not a
void return type which can be usefully set to the collection instead.

~TJ


More information about the es-discuss mailing list