Reverse decimal digits in javascript

后端 未结 14 916
灰色年华
灰色年华 2021-02-05 16:24

How do I reverse the digits of a number using bitwise?

input:

x = 123; 

output:

x = 321; 
14条回答
  •  盖世英雄少女心
    2021-02-05 17:17

    you also use this function

    function myfunction(a){
       var x=a.toString();
       var y= x.split("");
       var z=y.reverse();
       var result=z.join("");
         return result;
    

    } myfunction(123);

提交回复
热议问题