Given a double, I want to round it to a given number of points of precision after the decimal point, similar to PHP\'s round() function.
The closest thing I
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:
n = num.parse(n.toStringAsFixed(2));