Skip to content

Instantly share code, notes, and snippets.

@think2011
Last active October 10, 2016 09:02
Show Gist options
  • Save think2011/b34eb014df7df993b0c12d151cbbbe62 to your computer and use it in GitHub Desktop.
Save think2011/b34eb014df7df993b0c12d151cbbbe62 to your computer and use it in GitHub Desktop.
数字补零
//改自:http://blog.csdn.net/aimingoo/article/details/4492592
var len = ('' + num).length;
return (Array(
fill > len ? fill - len + 1 || 0 : 0
).join(0) + num);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment