1.Number
var a='+100' ============> Number(a) 100
var a=' ' ============> Number(a) 0
var a='sdfsdfsd ' ============> Number(a) NaN
var a='112' ============> Number(a) 112
var a=true ============> Number(a) 1
var a=false ============> Number(a) 0
var a= [] ============> Number(a) 0
var a= [''] ============> Number(a) 0
var a =[1] ============> Number(a) 1
var a =[1,2,3] ============> Number(a) NaN
var a = null ============> Number(a) 0
var a; ============> Number(a) NaN (因为a是undefind)
var json={} ============> Number(a) NaN
var json={name:'aa'} ============> Number(a) NaN
var a=function(){alert(1)} ============> Number(a) NaN
判断是整数还是小数的小技巧:
if(parseInt(num) == parseFloat(num)){
//整数
}else{
//小数
}
显示类型转换:Number() parseInt() parseFloat()
隐式类型转换: + = * / % ++ -- > <
字符串之间的比较是