1// JS fromEntries => list of key-values transformation into an object
2 const keys = ["name", "species", "age", "gender", "color"];
3 const values = ["Skitty", "cat", 9, "female", "tabby"];
4 const run = document.getElementById("run");
5 run.addEventListener("click", function () {
6 let createObj = [];
7 keys.forEach((item, index) => {
8 createObj.push([item, values[index]]);
9 });
10 const object = Object.fromEntries(createObj);
11 console.log(object);
12 });
13// expected output = Object { name: "Skitty", species: "cat", age: 9 etc..}
1const arr = [ ['0', 'a'], ['1', 'b'], ['2', 'c'] ];
2const obj = Object.fromEntries(arr);
3console.log(obj); // { 0: "a", 1: "b", 2: "c" }
4