Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15564] parseInt('09') returns 0 instead of 9 like a browser would

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2016-09-02T05:39:50.000+0000
Affected Version/sRelease 3.1.3
Fix Version/sn/a
ComponentsiOS
LabelsSupportTeam
ReporterHenry David Spells III
AssigneeEric Merriman
Created2013-10-20T05:24:11.000+0000
Updated2017-03-24T18:42:45.000+0000

Description

Problem Description

The user tries to do a parseInt with a format similar to the one will work in current Firefox or Chrome. We are interpreting the value as octal, instead of decimal as modern browsers do.

Steps to reproduce

1. Create a new mobile project 2. Paste this to app.js:
alert(parseInt("09"));
3. Check the alert, should be 9, but you get 0.

Extra info

The workaround is clear: alert(parseInt("09",10)); would do the work.

Comments

  1. Chris Barber 2016-09-02

    I cannot reproduce using Titanium SDK master (6.1.0).
  2. Lee Morris 2017-03-24

    Closing ticket as Cannot Reproduce with reference to the above comments.

JSON Source