Enable [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) to avoid this problem and many others!
– Ry-Feb 19 '18 at 13:13
To complement @SachinBankar's answer, do it with: `console.log(parseInt(012, 10))`
– ChrisFeb 19 '18 at 13:13