• Stu (unregistered)

    I remember spotting this bug in one of our systems. It was hellish to track down. Just reading this article made me shudder.

    Another 'fun' feature of the parseInt() function is that it returns the first number it comes across. It reads in every digit, until it either reaches the end of the string, or finds a non-number character, eg a letter or white space. So, give it the number "22someTtext000" it gives you 22, which is fairly sensible. But, you give it the number "22,000" and it converts that to 22.

    Combining these two features together led to a marathon exercise in tedious debugging. sigh

  • Ben (unregistered) in reply to Anon Fred
    Anon Fred:
    Why the HELL is there any constant which is inferred to be octal?

    Because Perl did the same thing!

    The only thing octal has ever been good for is file permissions. Octal should be shot in the head, driven over a cliff, shot in the head again, and then incinerated.

    Well, I'd rather like to kill octal too. As long as there is octal, JS developers will mistake Christmas for Helloween.

    Cos' 25 dec = 31 oct.

Leave a comment on “Thank you, Javascript”

Log In or post as a guest

Replying to comment #:

« Return to Article