I would like to know if there is a way to do this
there is a way to transform this
`["frontalCard","backCard"]`
to
`[{"frontalCard": false},{"backCard": false}]`
I would like to know if there is a way to do this
there is a way to transform this
`["frontalCard","backCard"]`
to
`[{"frontalCard": false},{"backCard": false}]`
Sure, you can do it with code like this using the Array map
function
let x = ["frontalCard","backCard"]
let y = x.map(a => ({ [a]: false }))
console.log(y)
stringArray.map(s => {
const o = {};
o[s] = false;
return o;
}