Published
- 1 min read
add leading zeros to number javascript
The solution for this is noted below
add leading zeros to number javascript
Solution
const number = 5
console.log(number.toString().padStart(2, '0')) // expected output: "05"
Try other methods by searching on the site. That is if this doesn’t work