entries in javascript code example
Example 1: javascript convert Object.entries back to object
const arr = [ ['0', 'a'], ['1', 'b'], ['2', 'c'] ];
const obj = Object.fromEntries(arr);
console.log(obj); // { 0: "a", 1: "b", 2: "c" }
Example 2: js entries
const object1 = { a: 'somestring', b: 42 };
for (const [key, value] of Object.entries(object1)) {
console.log(`${key}: ${value}`);
} // expected output: "a: somestring" "b: 42" order is not guaranteed