Hi I have been trying make this following array
[
{
"name": "Study",
"questions": [
{
"question": "Would you Love to learn about Java?",
"answer": "Yes"
}
]
},
{
"name": "Song",
"questions": [
{
"question": "Would you Love to learn about song?",
"answer": "Yes"
},
{
"question": "Would you Love to learn about rock?",
"answer": "No"
}
]
}
]
To this
[
{
"questions": [
{
"question": "Would you Love to learn about Java?",
"answer": "Yes",
"name": "Study"
}
]
},
{
"questions": [
{
"question": "Would you Love to learn about song?",
"answer": "Yes",
"name": "Song"
},
{
"question": "Would you Love to learn about rock?",
"answer": "No",
"name": "Song"
}
]
}
]
I have tried to map to two arrays ( from name and questions) and tried to combined them , but I can't make it work for multiple arrays in questions. How can I make this ? Is there any loadash way too accomplish this easily. But I'm trying to do this in Vanilla JavaScript way.