(1) display conversion type:
1.Number (a) is used to convert object a as a whole.
var a= ' 12345 ';
Number (a); a=12345
2.parseInt (a) is used to convert an object a from front to back, to start with a non-numeric stop conversion, to convert to an integer.
var a= ' 100px ';
parseint (a); a=100;
var a= ' +100px ';
parseint (a); a=100 for some of the ' +,-, Space ' symbols can be identified
3.parseFloat (a,10) is used to convert object a from post to decimal ; ' denotes decimal.
var a= ' 12.34 yuan ';
Parsefloat (a); a=12.34;
var a= ' 12.34.12 yuan ';
Parsefloat (a); a=12.34; only one decimal points can be identified
(2) implicit conversion type:
1.+ (200+'1') converted to a string
2.-*/% ('3') converted to digital
3.++--(a= '; a++ ') converted into numbers
Comparison of 4.> < numbers is different from string comparison
Alert (' >9 '); True
Alert (' Ten ' > ' 9 '); False
5.! Inverse (converts the right data type to a Boolean value)
6. = = value comparison; = = = The comparison of the advanced types, then the comparison of the values
Alert (' 2 ' ==2); True
7.isNaN used to determine whether the number is the number returned false , not a numeric return true
(Working principle: First Use the number () method to convert, and then judge)
IsNaN (' 250 '); False
JS data type and type conversion