darshthakkar
3 years agoValued Contributor
Can we round integers to 2 digits?
Hi Team,
I was using the Math.round() but was wondering if we can decide on the decimal digits for the rounding.
For example, number = 3.14125252
Desired output = 3.14
With Math.round(), outp...
- 3 years ago
- 3 years ago
Thank you @Soni37 for the insights.
I had to convert my string to a number and then apply this formula. I was also able to learn more about.toPrecision()
Link to the documentation
Thank you again.