How to assign multiple values to multiple variables in one line with TypeScript

1 Answer

0 votes
const [a, b, c, d]: [number, string, number, number] = [42, "ts", 3.14, 783524];

console.log(a, b, c, d);

 
 
/*
run:
 
42,  "ts",  3.14,  783524 
 
*/

 



answered Jul 14, 2025 by avibootz
...