05-27-2005, 12:08 AM
05-27-2005, 12:18 AM
See Liorean's post here (http://www.codingforums.com/showthread.php?t=39075)
05-27-2005, 12:25 AM
Thanks bass! helped a lot
a small addenda:
as Liorean said, parseInt() autodetects the hexa and octa numbers, so that it does not always return the values as they were in decimal base. A lot of people forget that parseInt() may be used along with it's parameter base.
So that, to be sure that parseInt('0112') will return 112 as we could expect in decimal, you must specify that the base is 10, otherwise it will return 74
parseInt('0112',10) //will return 112
parseInt('0112') //will return 74
You may see now that parseInt(variable,base) can be used as well for number translation from any base to the decimal base
parseInt('ff',16) // will translate the hexa number 'ff' into it's decimal equivalent 255
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.