I'm trying to map the answer property based on the type to a new single object
const questionsArray = [
{
question: `What is your name?`,
type: "name"
},
{
question: `What is your age?`,
type: "age"
}
]
Which will result to this:
bday = {
name: 'Jose',
age: '23',
}
This won't work because every question will replace the previous value already set since the type will be different
birthDayhave to be that or can it use the type ofdayand thus be the keydayinstead?