The number is a single digit or whatever its, I want the value as before 2 digit and after 3 digits in decimal value.
Received values:
7,
07,
07.1,
07.10,
17.222,
Expected output:
07.000, 07.000, 07.100, 07.100, 17.222
The number is a single digit or whatever its, I want the value as before 2 digit and after 3 digits in decimal value.
Received values:
7,
07,
07.1,
07.10,
17.222,
Expected output:
07.000, 07.000, 07.100, 07.100, 17.222
function formatNumber(number) {
return number.toFixed(3).padStart(6, '0');
}
Does this do the trick for you ?