text:
(1)parseInt()
parseInt ( "10", 2); // returns 2, represented by a binary string parsing the foregoing, generally not used
parseInt("1234blue"); //returns 1234 parseInt("123"); //returns 123 parseInt("22.5"); //returns 22 parseInt("blue"); //returns NaN
(2)parseFloat()
In decimal floating point, no base pattern
parseFloat("1234blue"); //returns 1234.0 parseFloat("22.5"); //returns 22.5 parseFloat("22.34.5"); //returns 22.34 parseFloat("0908"); //returns 908 parseFloat("blue"); //returns NaN
(3)Number()
Strong type conversion, overall conversion, not only the value conversion section
Number(false) 0 Number(true) 1 Number(undefined) NaN Number(null) 0 Number( "5.5 ") 5.5 Number( "56 ") 56 Number( "5.6.7 ") NaN Number(new Object()) NaN Number(100) 100
Reference blog:
jquery to convert the string to a number - u010865136 column - CSDN blog
https://blog.csdn.net/u010865136/article/details/49336255