var str ="12px";
console.log(Number("12px"));//NaN不是一个数字
var s ="";
console.log(Number(s));
console.log(Number(""));
console.log(Number(13));
var b =20;
var c =30 + ++b + ++b;
console.log(c);
console.log(b);
var a =1;
var c =4 + a++ + ++a;
console.log(c);
console.log(a);
var a =10;
var b ="true";
var c ="5";
var sum =a++ -c+b;
console.log(sum);
console.log(++a-c-b);
console.log(1-10*"5"+true);
console.log((2-"6")*3-false+true);
var a ="21";
var b =4;
console.log(a+b-true+"3");
console.log(a-b+true-"false");
var c ="false";
console.log(a-b+Boolean(c));
console.log("9"-8+false);//1false
console.log("9"-true-"false");//NaN
console.log("10"-true+"hellow");//9hellow
console.log(""-"9"+true-12);
var str ="12px";
var s = "12.34px";
console.log(parseInt(str));
console.log(parseInt(s));
console.log(parseFloat(str));
console.log(Number("12.343"))
number类型的转换
var a =10;
var b =0;
var c =-1;
console.log(Boolean(a))
console.log(Boolean(b))
console.log(Boolean(c))
var b = "12"-Boolean("")+true+1
console.log(b);//14
var c ="10"+1-Boolean("good")+"";
console.log(c);//100
var b ="1"+true-false;
console.log(b);//NaN