Map preserves insertion order, has size property, and allows any key type. Object has prototype chain.
Solution Code
JavaScript
const map = new Map();
map.set(1, 'one');
Explanation
Map performs better for frequent additions/removals. Use Object for simple key-value pairs.Guided Hints
When to use WeakMap?
How to iterate Map entries?