1// Function to reverse Number
2function reverseNum(n) {
3 let r = n.toString().split('').reverse().join('');
4 return Math.sign(n) * parseInt(r);
5}
6
7// Call
8reverseNum(-267);
9reverseNum(31522);
10
11// Outputs
12-762
1322513
1function reverse_a_number(n)
2{
3 n = n + "";
4 return n.split("").reverse().join("");
5}
6console.log(reverse_a_number(32243));
7