Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js concat

//ES6 spread operator same as arr1.concat(arr2)
var arr1 = ['1', '2', '3']
var arr2 = [4, 5, 6]
arr1 = [...arr1, arr2]   //... removes the [ and ] 
// leavin only an instance of inside.

output:
['1', '2', '3', 4, 5, 6 ]
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #js #concat
ADD COMMENT
Topic
Name
2+3 =