One. Convert string to Int, use parseInt() method
Usage: parseInt("88.5"); will return 88, and the value after the decimal point is ignored
If the string is not a number, NaN will be returned
Note: parseInt includes the base mode when converting, and will perform integer conversion according to the specified conversion base. The base is determined by the second parameter, such as:
parseInt("10", 2); Because of the set binary number, it will return 2. The corresponding support hexadecimal, octal, and decimal.
There is a special case if the first character of the string is 0, you need to pass in the specified base, otherwise it may be converted to an octal number.
two. String to float
parseFloat()
Note: parseFloat() has no base and can only convert decimal
Other usage is consistent with parseInt.