Last active
January 14, 2020 07:33
-
-
Save toshinoritakata/4249744 to your computer and use it in GitHub Desktop.
3桁でゼロパディング
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function padding3(num) { | |
var res; | |
if (eval(num) < 999) { | |
res = ("00"+num).slice(-3); | |
} else { | |
res = ""+num; //文字列に変換 | |
} | |
return res; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment