开发者

How do I parse the following string? [duplicate]

开发者 https://www.devze.com 2023-03-29 02:02 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicates: How to parseInt a string with leading 0
This question already has answers here: Closed 11 years ago.

Possible Duplicates:

How to parseInt a string with leading 0

Workarounds for JavaScript parseInt oc开发者_如何转开发tal bug

How can I parse the "09" into number?

alert(parseInt("09"));

This returns me 0 ..Why is that and how do I fix this?


Specify the base as well:

alert(parseInt("09", 10));  // outputs 9
0

精彩评论

暂无评论...
验证码 换一张
取 消