-2

Every time I do something like + 1.6 or something that's a decimal, I get a lot of random numbers spammed behind the result. how to avoid?

Jealousy
  • 57
  • 3

1 Answers1

-2

var test = 1.2345; console.log(test.toFixed(2))

// It will trim the result to the specified decimal places. // |----> output will be 1.23 in thid case... It will keep upto 2 decimal places