javascript - parseInt outputting int instead of octal number -


i've been following course in treehouse javascript. i'm on parseint method. in 1 of example, code shown:

var j = parseint("012"); 

saving , running in chrome's console resulted 10 in example (which understandable 012 10 in octal), in own browser, resulted 12. correct or doing wrong?

it's not strange - behavior implementation dependent.

it parse octal 012 or decimal 12.

it's best specify radix parameter when using parseint(), example parseint('012', 10).


Comments

Popular posts from this blog

python 3 IndexError: list index out of range -

android - How to save instance state of selected radiobutton on menu -

IF statement in MySQL trigger -