JS number converts to Float, take n decimal:
====================================
The variables in JavaScript are weak types. All variables are declared as VAR. During the type conversion process, it is not as convenient as Java. It is transformed by methods such as PARSEINT (variables) and PARSEFLOAT (variables). Note: There is no PARSEDOUBLE (variable) type conversion, because in JavaScript in JavaScript, single precision Float and dual -accuracy Double, variables with decimals in everything are considered to be Float, so you need to take the n bit after decimal. n) Come and get it.
For example:
var f = 2.56556;
f.tofixed (2);
You can get 2 digits after the variable F decimal. If it is not a Float type, it also needs to perform type conversion (PARSEFLOAT (variable name)) to obtain this method.