Set constructor arguments
Peter Michaux
petermichaux at gmail.com
Sun Feb 12 16:33:58 PST 2012
In the proposal, the Set constructor takes no arguments.
http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets
Could it take a list of initial elements to be included in the set?
var s = new Set('alpha', 'beta');
s.has('alpha'); // true
I think this is a lot better than the verbosity that is
var s = new Set();
s.add('alpha');
s.add('beta');
Peter
More information about the es-discuss
mailing list