How to convert char array into a single int in JavaScript

1 Answer

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



/*
run:

47095

*/

 



answered Sep 23, 2022 by avibootz

Related questions

1 answer 168 views
1 answer 197 views
1 answer 179 views
1 answer 163 views
...