js 集合各种工具

107 阅读1分钟

字符串填充 0

let num = 900;
let nStr = num.toString().padStart(8,'0');
console.log(nStr); //00000900