2 ms·
The syntax they have there is creating an array of arrays, and then passing that to the Map constructor, like you suspect. But it wouldn't be possible to make t
by shawnz 12y ago
The syntax they have there is creating an array of arrays, and then passing that to the Map constructor, like you suspect. But it wouldn't be possible to make that syntax produce a Map directly -- if it did, how would you produce an array of arrays?
EDIT: My mistake, I misunderstood what you were saying.
- nawitus 12y agoIt's easy to do with a helper function. For example, this works: var objectToMap = x => new Map(Object.keys(x).map(o => [o, x[o]]));
- raverbashing 12y agoBy original syntax I meant Map({a:1, b:2}) Yes, I wouldn't want to change the syntax for array of arrays.