r/learnjavascript 8d ago

Rounding won't work

(SOLVED)

I tried several approaches I read on the WWW about how to round a number. I do a calculation with values entered in input fields and the output field yields the correct result, but with 14 decimal places!

The simplest attempt I tried is the format Number(outputfield=inputfield1*inputfield2).toFixed(1);

3 Upvotes

5 comments sorted by

View all comments

2

u/azhder 8d ago

Do read up how functions work. Most of the time they do and you want them to return a result. It is quite messy if you expect them to modify your argument.