How to add elements into a tuple in TypeScript

1 Answer

0 votes
let tpl: [number, string] = [1, "TypeScript"];

tpl.push(2, "Java"); 

for (var t of tpl) {
    console.log(t); 
}
 



 
/*
 
run:
 
1 
"TypeScript" 
2 
"Java" 

*/

 



answered Oct 23, 2021 by avibootz
...