- 显式转换:特指Number(value)
- 隐式转换:非显式,比如“/”除号
1 let str="fly"; 2 let n=Number(str); 3 alert("6"/"2"); //3
- undefined:NaN
- null:0
- true:1; false:0
- string: 纯数字字符串返回数字;空串返回0;非数值型字符返回error
console.log(Number("123")); console.log(Number("")); console.log(Number("fly")); console.log(Number(true)); console.log(Number(false)); console.log(Number(undefined)); console.log(Number(null));