Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if i pass the value 0101 to a function it converts the value to 65...?

Status
Not open for further replies.

ktucci

Programmer
Joined
Apr 23, 2001
Messages
146
Location
US
if i pass the value 0101 to a function it converts the value to 65...?...any ideas...

thanks in advance

keith
 
Any number starting with a 0 is considered octal by Javascript. That means that your number equals 1 x 8 squared (0100) plus 1, or 65. If you want to convert it to decimal, multiply it by 1 (0101 * 1) or try parseInt('0101', 10). For decimal conversion, I've had better results with the multiplication than with parseInt().
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top