js补全前置零

1 function 补全前置0(num, length) {  
2     return (Array(length).join('0') + num).slice(-length);  
3 }

运行截图

原文地址:https://www.cnblogs.com/niao-ge/p/12177894.html