How to convert char array from the end to start into a single int in Node.js

1 Answer

0 votes
const arr = ['3', '9', '0', '8', '6', '1'];
        
const n = parseInt(arr.reverse().join(''), 10);
        
console.log(n);



/*
run:

168093

*/

 



answered Sep 23, 2022 by avibootz
...