Convert Integer value to decimal with only last 2 digit - Javascript Number Operation

Javascript examples for Number Operation:Integer

Description

Convert Integer value to decimal with only last 2 digit

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from w  w  w .ja  va2 s. c o m
var str = "01050";
var len=str.length;
var res = str.substring(0, len-2)+','+str.substring(len-2,len);
console.log(res);
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials