I have variable result. It contains each time different value. It is decimal number. How can i round or just show 3 decimal places?
Code:
var result = amount * exchangeRate1[fromCurrency] / exchangeRate2[toCurrency];
I have variable result. It contains each time different value. It is decimal number. How can i round or just show 3 decimal places?
Code:
var result = amount * exchangeRate1[fromCurrency] / exchangeRate2[toCurrency];
2
Answers
Try this:
if you want to SHOW 3 decimal places, you have to format value to string
if you use just Round
it will be shown less then 3 decimal places, if your result has less than 3 decimal places.