parseInt,parseFloat
Posted xnova
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了parseInt,parseFloat相关的知识,希望对你有一定的参考价值。
document.write(parseInt("10") + "<br>"); => 10
document.write(parseInt("10.33") + "<br>"); => 10
document.write(parseInt("34 45 66") + "<br>"); => 34
document.write(parseInt(" 60 ") + "<br>"); => 60
document.write(parseInt("40 years") + "<br>"); => 40
document.write(parseInt("He was 40") + "<br>"); => NaN
document.write(parseFloat("10") + "<br>"); => 10
document.write(parseFloat("10.33") + "<br>"); => 10.33
document.write(parseFloat("34 45 66") + "<br>"); => 34
document.write(parseFloat(" 60 ") + "<br>"); => 60
document.write(parseFloat("40 years") + "<br>"); => 40
document.write(parseFloat("He was 40") + "<br>"); => NaN
以上是关于parseInt,parseFloat的主要内容,如果未能解决你的问题,请参考以下文章