Closed
Bug 270169
Opened 20 years ago
Closed 20 years ago
JavaScript parseInt Global method does not work for leading zeros in string
Categories
(Toolkit Graveyard :: Error Console, defect)
Tracking
(Not tracked)
People
(Reporter: boblaurie, Assigned: bugs)
References
()
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
The standard JavaScript parseInt Global method does not work for leading zeros
in string. parseInt("09") returns a 0 not a 9 using Mozilla Firefox.
This issue is also a problem in IE.
The parseInt function does work correctly in the Opera browser. parseInt("09")
should return a numerical 9 for all browsers.
Problem was discovered in my JavaScript demo program at the following URL:
http://www.islandman.org/_uog/cs201/parseIntBug.html
Reproducible: Always
Steps to Reproduce:
1.Create JavaScript program that uses parseInt with the argument string has a
leading zero such as "0123".
2. Numerical return value should be 123, but becomes 83
3. For Example see http://www.islandman.org/_uog/cs201/parseIntBug.html
Actual Results:
Always is a problem
Expected Results:
parseInt JavaScript function should return a numerical value without the leading
zero. parseInt("0123") should return a numerical value 123
Opera runs this parseInt JavaScript function correctly. IE has same problem as
FireFox.
Comment 1•20 years ago
|
||
Nope, not a bug: see http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf 15.1.2.2 *** This bug has been marked as a duplicate of 43425 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Updated•20 years ago
|
Status: RESOLVED → VERIFIED
Updated•16 years ago
|
Product: Firefox → Toolkit
Updated•8 years ago
|
Product: Toolkit → Toolkit Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•