function n(num, len = 2) {
return `${num}`.padStart(len, '0');
}
console.log(n( 9)); //print "09"
console.log(n(10)); //print "10"
console.log(n(999)); //print "999"
console.log(n(999,6));//print "000999"
const formattedNumber = num => {
return num.toLocaleString('en-US', {
minimumIntegerDigits: 2,
useGrouping: false
})
}
const formattedNumber = num => {
return num.toLocaleString('en-US', {
minimumIntegerDigits: 3,
useGrouping: false
})
}