Sen Hongo
Now
Blog
About
Contact
Try Millefeuille
Pad a number with leading zeros
published: 2022/08/04
category: dev
tags:
js
Using
String.prototype.padStart()
const
n
=
1
;
String
(n).
padStart
(
5
,
'0'
);
// '00001'