parseInt("08") returns NaN

Discuss all problems you have with Servoy here. It might help to mention the Servoy version and Operating System version you are using

parseInt("08") returns NaN

Postby cl@muc » Mon Sep 16, 2013 10:32 pm

Hello,

the funtion calls
Code: Select all
parseInt("08"); // returns NaN
and
parseInt("09"); // returns NaN
both return NaN.

The funtion call
Code: Select all
parseInt("07"); // returns 7
returns the correct value: 7.

So this obviously seems to be a bug.

Does anybody else have this problem?

Thanks,
Christoph
Christoph Langheld
http://www.project-print.de
cl@muc
 
Posts: 11
Joined: Thu Sep 28, 2006 9:55 pm
Location: Munich

Re: parseInt("08") returns NaN

Postby peterbliskavka » Tue Sep 17, 2013 12:12 am

Yes.

Also, parseInt("008") and parseInt("009") return 0.0, and parseInt("0008") parseInt("0009") also return 0.0.

parseInt("0019") returns 1.0..... weird.
peterbliskavka
 
Posts: 30
Joined: Tue May 21, 2013 3:42 pm

Re: parseInt("08") returns NaN

Postby david » Tue Sep 17, 2013 5:03 am

parseInt makes assumptions when leading zeros are present and the radix is not specified. Specifically with the version of Rhino Servoy is using octal is assumed.

https://developer.mozilla.org/en-US/doc ... s/parseInt
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.


Return to Discuss possible Issues and Bugs

Who is online

Users browsing this forum: No registered users and 8 guests

cron