parseInt() 是一个字符串一个字符串的解析 返回的是整数(不四舍五入)假如123adc 返回123
Number转换的值必需是存字符串 假如adc123 返回NaN
<font color="red">
带parse 开头 对于解析都是一个一个解析的
<!DOCTYPE html><html lang="zh"><head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>Document</title> <script type="text/javascript"> var a=123; var b=true; c=String(a); d=String(b); console.log(c); console.log(d); console.log(typeof c); //String console.log(typeof d);//String //转换boolean var x=false; x=Boolean(x); console.log(x); console.log(typeof x);// 变成boolean //自动转换 为number 自动是说运算的时候自动转换,原始变量并不是转换成本身 var a="123"; a= +a; console.log(a); console.log(typeof a); </script></head><body> </body></html>