How to merge multiple arrays in TypeScript

1 Answer

0 votes
const arr1: number[] = [432, 10, 99];
const arr2: number[] = [8, 14];
const arr3: number[] = [1, 2, 3, 4];
  
const arr: number[]  = [...arr1, ...arr2, ...arr3];
  
console.log(arr);
  
  
       
/*
run:
     
[432, 10, 99, 8, 14, 1, 2, 3, 4] 
   
*/

 



answered Nov 1, 2024 by avibootz
...