How to use spread syntax (...) to concatenate arrays in JavaScript

1 Answer

0 votes
let arr1 = [7, 0, 9];
let arr2 = [8, 2, 1]; 

arr1 = arr1.concat(arr2);

console.log(arr1);




/*
run:
 
[7, 0, 9, 8, 2, 1] 
 
*/

 



answered Nov 17, 2020 by avibootz

Related questions

1 answer 198 views
1 answer 251 views
2 answers 211 views
1 answer 162 views
1 answer 163 views
1 answer 175 views
...