possible duplicate:
javascript equivalent printf/string.format
how can create zerofilled value using javascript?
i have number in variable:
var number = 5;
i need number output 05:
alert(number); // want alert display 05, rather 5.
how can this?
i manually check number , add 0 string, hoping there's js function it?
there's no built-in javascript function this, can write own easily:
function pad(n) { return (n < 10) ? ("0" + n) : n; }
Comments
Post a Comment