I have the following array:
const x = [
{event: "oninput", action: ""},
{event: "onfocus", action: ""}
]
Following is the desired output:
// event: action
{
oninput: "",
onfocus: ""
}
I tried the following which didn't really work:
const x = [
{event: "oninput", action: ""},
{event: "onfocus", action: ""}
]
console.log({...x.map(y => {return {[y.event]: y.action}})})