当给定数字位数不足8位时,则在左边补充0以补足8位数。 let num = 900; let nStr = num.toString().padStart(8,'0'); console.log(nStr)