Answers for "prepend zeros javascript"

3

js number add zero before

('0' + 11).slice(-2) // '11'
('0' + 4).slice(-2)  // '04'
Posted by: Guest on December-05-2020
1

add zero in front of numbers javascript

function checkTime(i) {
    if (i<10) {i = "0" + i};  // add zero in front of numbers < 10
    return i;
}
Posted by: Guest on September-03-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language