function reverse(num) {
const a = num % 10;
const b = Math.round(num % 100 / 10);
const c = Math.round(num % 1000 / 100);
let result = '';
result += a;
result += b;
result += c;
// return +result;
// console.log([...num.toString()].length)
for (let i = 0; i < num.toString().length; i++) {
}
}
console.log(reverse(321));
Click Run to execute JavaScript.
Code runs in an isolated environment.
Code runs in an isolated environment.