I am facing an issue with two arrays received from a URL in Angular. I am attempting to combine the two arrays into a single array.
"admin":[
{
"Name":"John",
"Age":34
},
{
"Name:"Joe",
"Age":56
}
],
"users":[
{
"Name":"John",
"Age":34
},
{
"Name:"Joe",
"Age":56
}
]
I have tried to merge the two arrays using:
public newArr=[];
join(){
this.newArr=this.newArray.concat(this.admin,this.users)
console.log(this.this.newArr.length);
//the result shown in the console is 0
}
I also attempted another method:
join(){
this.newArr.push(...this.users,...this.admins)
console.log(this.newArr.length)
//the results is still 0
}
I am seeking guidance on the correct approach for this issue.