How to convert char array into a single int in TypeScript

1 Answer

0 votes
const arr : string[] = ['8', '7', '0', '9', '4'];
        
const n : number = parseInt(arr.join(''), 10);
        
console.log(n);




/*
run:

87094 

*/

 



answered Sep 23, 2022 by avibootz

Related questions

1 answer 164 views
1 answer 174 views
1 answer 174 views
1 answer 160 views
...