转自
// 转换成字符型 var married = false; alert(married.toString());
// 字符型转换成其他 var test = parseInt(“blue”); //returns NaN var test = parseInt(“1234blue”); //returns 1234 var test = parseInt(“22.5”); //returns 22 var test = parseFloat(“1234blue”); //returns 1234 var test = parseFloat(“22.5”); //returns 22.5