How to append two arrays to another array in JavaScript

1 Answer

0 votes
const arr1 = [4, 1, 2, 8, 9, 5, 5, 1, 7];
        
const arr2 = ['javascript', 'c++'];

const arr3 = [...arr1, ...arr2];

console.log(arr3); 


      
      
/*
run:
      
[4, 1, 2, 8, 9, 5, 5, 1, 7, "javascript", "c++"]
        
*/

 



answered Jun 28, 2022 by avibootz

Related questions

1 answer 210 views
1 answer 188 views
1 answer 265 views
1 answer 241 views
...