* 一、转化为数字*/
console.log(‘123123’*1.0);/* 二、从一个值中提取另一中类型的值,并完成转化工作 */
console.log(parseInt(‘1233zxhag’)); //1233console.log(parseFloat(‘1.123aef’)); //1.123console.log(eval(1+123)); //124console.log(toString(123)); //[object Window] ‘123’/* 将整个值从一种类型转化成另一种类型(称作基本类型转换) */
console.log(String(‘123123′));console.log(String(null)); //nullconsole.log(String(undefined)); //undefinedconsole.log(Number(‘123123′));console.log(Number(null)); // 0console.log(Number(undefined)); //NaNconsole.log(Boolean(123123)); //trueconsole.log(Boolean(null)); //falseconsole.log(Boolean(undefined)); //false 本文转自(http://dayney.com/?p=38)