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
JavaScript 2025 · Objects and data
Turn an array of [key, value] pairs into an object.
const obj = Object.fromEntries([["a", 1], ["b", 2]]);
Official JavaScript 2025 documentation
Was this page helpful?