DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR JAVASCRIPT
add leading zeros to number javascript
const
number
=
5
;
console
.
log
(
number
.
toString
(
)
.
padStart
(
2
,
'0'
)
)
;
// expected output: "05"
PREVIOUS
NEXT
Tagged:
#add
#leading
#zeros
#number
#javascript
ADD COMMENT
Topic
COMMENT
Name
4+6 =
Submit