Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript push array into array

const vegetables = ['parsnip', 'potato'];
const moreVegs = ['celery', 'beetroot'];

// Merge the second array into the first one
vegetables.push(...moreVegs);

console.log(vegetables); // ['parsnip', 'potato', 'celery', 'beetroot']
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #push #array #array
ADD COMMENT
Topic
Name
5+5 =