1 隐式转换
1 . 注意7假值 false 0 "" NaN null undefined -0 ,
2 . 注意6个零值 0 "0" false [] null ""
3 ."42" == 42 返回true
4 .1+2+'3'; //'33' 加法运算是从左到右,所以等价于(1+2)+'3'
5 .'8'|'1' //9
6 .1+'2'+3; //'123'
7 .''+1; //'1'
8 . +'1'; //1
2 显示转换
var foo = "42";
var myNumber = +foo; // shortcut for Number(foo)
var negativeFoo = -foo;
// or -Number(foo)
// → -42
var foo = 42;
"" + foo // shortcut for String(foo)
// → "42"
foo = { hello: "world" };
JSON.stringify(foo);
// → '{ "hello":"world" }'
// Note you cannot JSON.stringify circular structures
JSON.stringify(window);