当前位置:网站首页>JS number is insufficient, and 0 is added

JS number is insufficient, and 0 is added

2022-07-07 22:21:00 Belden wind

Mode one , Use padStart

'9'.padStart(2,0);// 09

Mode two , Use Intl.NumberFormat

new Intl.NumberFormat(undefined, {
    minimumIntegerDigits: 2,
    useGrouping:false
}).format(9);//09
原网站

版权声明
本文为[Belden wind]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130607021945.html