How can I efficiently merge two arrays of objects from the same response?
let data = [{
"testLevel":"mid",
"testId":"m-001",
"majorCourse": [
{
"courseName":"C++",
}
],
"additinalCertificate" : [
{
"courseName":"Data Structure",
}
{
"courseName":"Intra Networking and design - level 1",
}
]
}]
expected:
newObj = [{{"courseName":"C++"},{"courseName":"DS"}}]
I have a specific requirement in my Angular app where I need to display the merged data without using nested 'ngFor'. I want to show it like this:
1. C++
2. C++ + DS
Feeling exhausted...
let combine = [...data[0].majorCourse, ...data[0].additinalCertificate];
console.log('combine',combine); // getting undefined
Can anyone suggest an ES6 or better solution to achieve this task?
Thank you