javascript - js parseInt 也能转换对象?
巴扎黑
巴扎黑 2017-04-10 17:00:35
0
1
254
parseFloat({a:1,toString:function(){return "+111"}});

输出 111

为啥??   
巴扎黑
巴扎黑

Antworte allen(1)
洪涛

根据http://es5.github.io/#x15.1.2.3

第一部是调用参数的toString方法,即parseFloat("+111") // 111

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage