Skip to main content

Posts

Showing posts with the label parseInt

parseInt() galore

After the Falsy post, here is another interesting table listing various values as evaluated by parseInt(). Some are quirky indeed :)

Free lunch to anyone who shows me another table that covers parseInt() in such detail :P

ExpressionValueRemarksparseInt("23")23parseInt(" 23")23Leading white space is droppedparseInt("-23")-23parseInt(23)23parseInt(023)19Radix 8 is usedparseInt(0x23)35Radix 16 is usedparseInt("23",4)11Radix 4 is usedparseInt("23",4.99)11Radix is always converted to int32parseInt("23",36)75Radix 36 is usedparseInt("z",36)35Radix 36 is usedparseInt("23",37)NaNMax Radix is 36parseInt("23",1)NaNMin Radix is 2parseInt("23",0)23Radix used is 10parseInt("23",-1)NaNMin Radix is 2parseInt("23",3)2Radix 3 can use only 0,1,2parseInt("023")19Radix defaults to 8parseInt("0x23")35Radix defaults to 16parseInt("023",5)13Radix used is 5parseI…