3 ms·
new Map([[k1,v1], [k2, v2]]) can do that. Or Object.fromEntries with the same argument.
by wiredearp 5y ago
new Map([[k1,v1], [k2, v2]]) can do that. Or Object.fromEntries with the same argument.
- tarjei_huse 5y agoThanks! You still need to create the middle datastructure ( [[k1,v1], [k2, v2]] ) but it is an improvement :)
- wiredearp 5y agoAh yes, true, you always need to map the things ID to the thing itself, so that middle data structure is actually quite annoying :)