I have a variable with a result that looks like this:
myresult = 14.4565576
I need to round the decimal after the DOT to only 3 numbers.
For example I need to round this:
14.4565576
to this:
14.456
How can I do this?
CodePudding user response:
You can use the toFixed method
const number = 14.4565576
console.log(number.toFixed(3))