I want to store my dates that i generated inside my map function, now it stores as array inside my endDate, i tried using forEach but it returns undefiened
here is my stackblitz
console.log(this.final); // ["2033-05-19T20:00:00.000Z", "2025-11-04T11:26:28.316Z"]
this.personalInfo = {
personalInfoId: 0,
underageChildInfo: this.data.underageChildInfo?.map((i) => ({
firstName: i.name,
endDate: this.final
}))
};
This might be your solution then. Although here I'm assuming that your this.final has atleast this.data.underageChildInfo?.length values.
this.personalInfo = {
personalInfoId: 0,
underageChildInfo: this.data.underageChildInfo?.map((value,index) => ({
firstName: value.name,
endDate: this.final[index],
})),
};