I'm puzzled by the fact that in order to utilize a Map object, it's necessary to destructure it into an array of arrays first. This process feels counterintuitive.
Could someone shed light on the reasoning behind this design choice? I'm aware that languages like Scala have map methods for Maps, so I'm curious as to why JavaScript lacks this feature.
The syntax appears unnecessarily complex and verbose:
let mappedMap = new Map(
[...originalMap]
.map(([k, v]) => [k * 2, '_' + v])
);
Wouldn't it make more sense to have a simpler approach like this?
let mappedMap = originalMap.map((k, v) => [k * 2, '_' + v]);