Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to do type conversion in the return result of JS function, from INT to FLOAT
How to do type conversion in the return result of JS function, from INT to FLOAT
Multiply it directly by a 1.0, and it will change from int to float.

Js is a weak language type, declaring that variables are all in the form of var, and assigning any value to the type of variables.

Example:

var? a = 1; //integer,int

a = a * 1.0; //is a floating-point type, that is, it has a decimal.