How to append two arrays to another array in TypeScript

1 Answer

0 votes
const arr1 = [6, 1, 2, 8, 9, 5, 5, 1, 7];
        
const arr2 = ['typescript', 'php'];

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

console.log(arr3); 


      
      
/*
run:
      
[6, 1, 2, 8, 9, 5, 5, 1, 7, "typescript", "php"] 
        
*/

 



answered Jun 28, 2022 by avibootz

Related questions

1 answer 118 views
1 answer 140 views
1 answer 158 views
1 answer 97 views
1 answer 117 views
1 answer 190 views
...