SyntaxFix
Write A Post
Hire A Developer
Questions
num.toStringAsFixed() rounds. This one turns you num (n) into a string with the number of decimals you want (2), and then parses it back to your num in one sweet line of code:
num.toStringAsFixed()
n = num.parse(n.toStringAsFixed(2));