Object.entries()
ES2017+Returns an array of a given object's own enumerable property [key, value] pairs.
Syntax
Object.entries(obj)Parameters
obj Object The object whose enumerable own property [key, value] pairs are to be returned
Return Value
Array
An array of [key, value] pairs
Examples
JavaScript
const obj = { a: 1, b: 2 };
console.log(Object.entries(obj)); Output:
// [['a', 1], ['b', 2]]