How to Reverse a Number In JavaScript


In this tutorial, you’ll see how to reverse a number in JavaScript. There is no direct method to reverse a number in JavaScript. You’ll convert a number to string, then to array, reverse it and convert it back to number.

    function reverseNumber(num){
      return Number(String(num).split("").reverse().join(""))
    }
    
    console.log(reverseNumber(123))