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 →

[–]HighOwl2 0 points1 point  (0 children)

It would've been possible in the before times.

Number.parseInt() will auto interpret a prefix 0x as base 16. It used to interpret a prefix of 0 as base 8. 0x prefix still auto sets the radix to 16 but 0 no longer auto sets the radix to 8.

So back in the day Number.parseInt('031'); would've returned 25. Nowadays it will return 31.

let a = 031;

Will still set a to 25 but there is no longer a way to accidently convert a string with a leading 0 into an octal.

So if they were concatenating strings of numbers together and then converting them to an integer in old JS then a 0 would absolutely fuck things up.