Additional cascading Map/Set/WeakMap methods?

Allen Wirfs-Brock allen at
Sun Jan 13 16:44:19 PST 2013

At the last TC39 meeting, it was agreed tothat the set/add methods would return the collection that to which something is being added.

This supports code patterns like:


In making this change to the spec. I noticed several other methods that could reasonably be used in this same pattern. For example:

someMap.clear().set(aKey, aValue);


Are there any objections to making the clear and delete methods of Map/WeakMap/Set also return the collection, just like set/add?


More information about the es-discuss mailing list