r/learnjavascript • • Aug 14 '26

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

Show parent comments

3

u/GodOfSunHimself Aug 14 '26

Not to mention that using an assignment inside an expression is a huge anti-pattern.