3 ms·
I wouldn't say it's false, I would say it's no longer true in strict mode. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Deprecated_
by reificator 7y ago
I wouldn't say it's false, I would say it's no longer true in strict mode.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Deprecated_octal https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Javascript for many years has assumed a leading zero means an octal prefix, and it's only recently that behavior has changed.
EDIT: Also your example does not disprove this. Here's another example that you should try running in the console:
011 === 11; // false
011; // 9
- johnhenry 7y agoThanks for the link! EDIT: Also, yes, I the mistake with my initial example -- as '8' doesn't exist in octal, we have no choice but to interpret the leading '0' as padding and '08' as base ten, whereas '11' can be interpreted as base eight.