4 ms·
We're not talking about parsing in base 10, we're talking about parsing in base 8. I need to be able to tell if the parse succeeded or not, silently hiding err
by papsosouid 14y ago
We're not talking about parsing in base 10, we're talking about parsing in base 8. I need to be able to tell if the parse succeeded or not, silently hiding errors is bad. The correct behaviour demonstrated in perl and python:
$ perl -le 'print 07'
7
$ perl -le 'print 08'
Illegal octal digit '8' at -e line 1, at end of line
Execution of -e aborted due to compilation errors.
$ python -c 'print 07'
7
$ python -c 'print 08'
File "", line 1
print 08
^
SyntaxError: invalid token
- user24 14y agoGot to admit, I am disappointed that > parseInt("08", 8); returns 0 instead of NaN