Within a single input field, users can enter various numbers such as 12, 12.1, 12.30, and 12.34. The challenge is to pass this value in a service call where only the value can be sent as a number but with two decimal points.
let a = input //a will be a type of number
let b = a.toFixed(2) //b will be type of string
let c = Number(b) //it will automatically cut unwanted '0'
console.log(c);
EXAMPLE
//input is 12
a=12
b="12.00"
c=12
//input is 12.30
a=12.30
b="12.30"
c=12.3
I am searching for a method that allows me to input a value as a number and receive an output with two decimal points.