var a=2.1572131231231321; var result=a.toFixed(2) alert(result); //2.16 alert(typeof(a)); //number类型 alert(typeof(result)); //string类型 注意类型发生了改变