Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

add leading zeros javascript


function pad(num, size) {
    num = num.toString();
    while (num.length < size) num = "0" + num;
    return num;
}

Source by nullorempty.org #
 
PREVIOUS NEXT
Tagged: #add #leading #zeros #javascript
ADD COMMENT
Topic
Name
3+9 =