JavaScript 2025 · Objects and data

Build an object from pairs

Turn an array of [key, value] pairs into an object.

const obj = Object.fromEntries([["a", 1], ["b", 2]]);

Official JavaScript 2025 documentation

More objects and data commands

All objects and data commands · JavaScript 2025 cheatsheet

Was this page helpful?