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 162 views
1 answer 191 views
1 answer 173 views
1 answer 160 views
...