What is the best way to combine two array of object from 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"}}]
Here what i'm trying to achieve is. i want to bind data in my angular app *(not using nested 'ngFor' for some reason) like
1. C++
2. C++ + DS
so tired
let combine = [...data[0].majorCourse, ...data[0].additinalCertificate];
console.log('combine',combine); // getting undefined
could someone tell me how to achieve this with es6 or better solution?
Thanks
majorCourseandadditinalCertificatehere. Also check ifdatais there before performing the merge process.