Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript remove leading zeros from string

use a regular expression like this  

var strNumber = "0049";  
console.log(typeof strNumber); //string  
  
var number  = strNumber.replace(/^0+/, ''); 
 
PREVIOUS NEXT
Tagged: #javascript #remove #leading #zeros #string
ADD COMMENT
Topic
Name
9+1 =