eval(50).toFixed(2)>eval(100).toFixed(2)
true
被当成字符串处理了??
![]() |
1
CosWind 2015-08-04 18:38:28 +08:00 ![]() toFixed返回的是string,可以用typeof看一下
|
![]() |
2
an168bang521 2015-08-04 19:19:49 +08:00 ![]() 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-08-04 19:22:21 +08:00 ![]() b= a.toFixed(2), 后面是逗号,不是分号;楼主可以把一个一个的输出来看看;
|
![]() |
4
liking09 2015-08-04 22:18:11 +08:00 via Android
test
|
![]() |
5
liking09 2015-08-04 22:18:29 +08:00 via Android
teat
|