document.write ("Integer conversion function: parseint (data, Base) <br>"); document.write ("10101=>" + parseint ("10101", 2) + "<br>"); document.write ("77=>" + parseint ("8") + "<br>"); document.write ("2a3b=>" + parseint ("2a3b", +) + "<br>"); document.write ("077=>" + parseint ("077") + "<br>"); document.write ("0x2a3b=>" + parseint ("0x2a3b") + "<br>"); document.write ("floating-point conversion function: parsefloat (data) <br>"); var str = "12.345"; var str1 = str + 6; var str2 = parsefloat (str) + 6, document.write (str1 + "=" + parsefloat (str1) + "<br>"), document.write (str1 + "= +" + parsefloat (str2) + "<br>"); document.write ("34.89a23=>" + parsefloat ("34.89a23") + "<br>"); document.write ("Digital judgment Function:isnan<br>"); document.write ("4 is number:" +!isnan (4) + "<br>"); document.write ("FFFF is number:" +!isnan ("FFFF") + "<br>");
Results:
10101=>2177=>632a3b=>10811077=>630x2a3b=>10811 floating-point conversion function: parsefloat (data) 12.3456=>12.345612.3456= >18.34534.89a23=>34.89 number judgment function: IsNaN4 is a number: TRUEFFFF is a number: false
JS binary conversion, floating-point number addition, digital judgment