Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var vegetables = ['parsnip', 'potato'];
- var moreVegs = ['celery', 'beetroot'];
- // Merge the second array into the first one
- // Equivalent to vegetables.push('celery', 'beetroot');
- Array.prototype.push.apply(vegetables, moreVegs);
- console.log(vegetables); // ['parsnip', 'potato', 'celery', 'beetroot']
Add Comment
Please, Sign In to add comment