JS

parseInt('')
NaN
parseInt(null)
NaN
parseInt(undefined)
NaN
parseInt('asdfa')
NaN
parseInt('123')
123
parseInt('asd12')
NaN
// 转换后只保留前面数字
parseInt('1213ewer') 
1213
parseInt(false)
NaN

Number('')
0
Number(null)
0
Number(false)
0
Number(undefined)
NaN


Number(-1)
-1
parseInt(-1)
-1
原文地址:https://www.cnblogs.com/smallyi/p/14268574.html