I have a nested data inside which I am trying to push my response I am getting from the server,
My data is :
let d = [{
"dashId": 3,
"dashName": "one",
"dashData": []
},
{
"dashId": 4,
"dashName": "two",
"dashData": [{
"nestedId": 1,
"nestedData": "how are you"
}]
}
]
This the data below I want to push
let res = [{
"nestedId": 11,
"nestedData": "I am fine"
}]
What I am doing is:-
let dd = d.map(li => {
if (li.dashId === 3) {
li.dashData.push(res)
}
})
console.log(dd)
I am getting output as undefined
[ undefined, undefined ]