spread operator angular 2+ :: Merge Two arrays

0
834

Hello all,

I used this when i don’t have to push the array in another variable because push creates position also of the array. so, this makes my working or result not according my requirement.

Then i use Spread Operator to overcome this issue

this.mainArray = [...this.mainArray, ...this.subArray];

LEAVE A REPLY

Please enter your comment!
Please enter your name here