Gayathri Kumaran posted: " Similar to padding a number with leading zeros, we can pad a number into two digits in JavaScript. function padToTwoDigits(number) { return (number < 10 ? '0' : '') + number } console.log(padToTwoDigits(9)); //09 console.log(padToTwoDigits("
|

No comments:
Post a Comment
Note: Only a member of this blog may post a comment.