Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

combine 2 arrays javascript

//ES6 using the spread operator
const itemsA = [ 'Lightsaber', 'Mockingjay pin', 'Box of chocolates' ];
const itemsB = [ 'Ghost trap', 'The One Ring', 'DeLorean' ]
const allItems = [ ...itemsA, ...itemsB ];
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #combine #arrays #javascript
ADD COMMENT
Topic
Name
8+3 =