turn array of entries into object code example
Example 1: js array into object
const names = ['Alex', 'Bob', 'Johny', 'Atta'];
const obj = Object.assign({}, names);
console.log(obj);
Example 2: javascript fromEntries
const keys = ["name", "species", "age", "gender", "color"];
const values = ["Skitty", "cat", 9, "female", "tabby"];
const run = document.getElementById("run");
run.addEventListener("click", function () {
let createObj = [];
keys.forEach((item, index) => {
createObj.push([item, values[index]]);
});
const object = Object.fromEntries(createObj);
console.log(object);
});