Possible Duplicate:
Workarounds for JavaScript parseInt octal bug
Here's a jsfiddle that shows the behavior:
Pretty simple question, any ideas?
Code is just:
parseInt(013)
Possible Duplicate:
Workarounds for JavaScript parseInt octal bug
Here's a jsfiddle that shows the behavior:
Pretty simple question, any ideas?
Code is just:
parseInt(013)
Because if your number is starting with '0', then it's considered as octal, thus
'013' = 1 * 8 + 3 = 11
 
    
    parseInt() expects a string. You have provided an octal, 013.
Use:
parseInt('013', 10)
Note: I would also encourage passing radix, for clarity.
 
    
    The number 013 is being interpreted as an octal.  It has nothing to do with parseInt; in fact, var a = 013; will have a be 11. 
