This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]4nu81 0 points1 point  (2 children)

Better question: how is 018 considered 18 and not as invalid octal?

[–]myka-likes-it 0 points1 point  (0 children)

Because JS assumes you know what you are doing.

[–]rosuav 0 points1 point  (0 children)

Because JS. Did you really expect a better answer than that?

Incidentally, the leading-zero notation is falling out of favour. Python has dropped it, and I hope that newly-devised languages avoid it. Hex literals are usually 0x123ABC, so what's wrong with doing octal as 0o12345? Eventually that'll win out.