Read here. Code on desktop. The coding workspace opens on screens 1024px and wider.
JavaScript interview question
From Pairs
easy10 min
Build a new object from an array of key-value pairs, with later entries replacing earlier values for the same key.
Requirements
Implement fromPairs(pairs). Each pair is a two-element array [key, value]. Return a new plain object with each key as an own, enumerable, writable property.
Keys may be strings, numbers, or symbols. Numeric keys become string property names; symbol keys retain their identity.
If a key appears more than once, the last value wins. Empty input returns an empty object.
Treat __proto__, constructor, and toString as ordinary own keys without changing the result prototype.
Do not mutate the pairs or clone their values. Do not use Object.fromEntries. Assume all pairs have valid keys and exactly two elements.