2 ms·
Hummm My bet is that the Map() is turning an array of arrays into a map. And that in the future it will convert the original syntax into a Map as well
by raverbashing 12y ago
Hummm
My bet is that the Map() is turning an array of arrays into a map. And that in the future it will convert the original syntax into a Map as well
- shawnz 12y agoThe 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.