I have two arrays now once i rendered the data from backend i want to push just object from array2 to array1 not the array itself.
How can i just push object from array2 to array1 I dont want to push as array.
ctrl.js
var array1 = [{name:'john', address:'cliffwood ave'}]
var array2 = [{name:'Mike', address:'florence ave'}]
array1.push(array2);
If you wanted to push a single object in the array, you could just reference it by it's specific index :
array1.push(array2[0]);
Otherwise, if you wanted to push all of the items, you might consider just concatenating them via the concat()
function :
array1.concat(array2);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments