Ad
Code
Diff
  • export function reverseInt(n: number) {
      return parseInt(new String(n).split('').reverse().join(''))
    }
    • function reverseInt(n) {
    • let reversed = 0;
    • while(n >= 0){
    • reversed = reversed * 10 + (n % 10);
    • n /= 10;
    • }
    • return reversed;
    • }
    • export function reverseInt(n: number) {
    • return parseInt(new String(n).split('').reverse().join(''))
    • }