Object.entriesintermediate// Get [key, value] pairs of an object
const obj = { a: 1, b: 2 }
Object.entries(obj) // β [['a', 1], ['b', 2]]Use Object.entries() to get an array of [key, value] pairs for iterating over an object's own enumerable properties.
Since Object.entries returns [key, value] pairs, you can pass the result directly to the Map constructor.
Challenge: Implement toMap(obj) that converts a plain object to a Map using Object.entries.
toMap({ a: 1, b: 2 }) // β Map { 'a' => 1, 'b' => 2 }