Object.fromEntriesbeginner// Build an object from [key, value] pairs
const entries = [['a', 1], ['b', 2]]
Object.fromEntries(entries) // β { a: 1, b: 2 }Use Object.fromEntries() to convert an iterable of [key, value] pairs into a plain object.
Since Map is iterable and yields [key, value] pairs, you can pass a Map directly to Object.fromEntries.
Challenge: Implement mapToObject(map) that converts a Map<string, unknown> to a plain object.
mapToObject(new Map([['a', 1], ['b', 2]])) // β { a: 1, b: 2 }