
eval(50).toFixed(2)>eval(100).toFixed(2)
true
被当成字符串处理了??
1 CosWind 2015 年 8 月 4 日 toFixed返回的是string,可以用typeof看一下 |
2 an168bang521 2015 年 8 月 4 日 var a=eval("50"), b= a.toFixed(2); c=parseInt(b); console.log(typeof a);//number console.log(typeof b);//string console.log(typeof c);//number console.log(eval(50).toFixed(2)>eval(100).toFixed(2));//true console.log(parseInt(eval(50).toFixed(2))>parseInt(eval(100).toFixed(2)));//false |
3 an168bang521 2015 年 8 月 4 日 b= a.toFixed(2), 后面是逗号,不是分号;楼主可以把一个一个的输出来看看; |
4 liking09 2015 年 8 月 4 日 via Android test |
5 liking09 2015 年 8 月 4 日 via Android teat |