- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
console.log(parseInt('Frist'));
Admin
Is that how you print a stack trace in PHP?
Admin
It works if your goal ist to print "NaN" to the console.
Admin
Well, idk about PHP, but that looks like parsing a hex number to me. c + 16b + 256a
Admin
No, that how you print "NaN" in the javascript console.
Admin
but clearly "abc" is a number - look:
typeof(parseInt('abc'))
==> "number"Admin
Remember your abc's: add bogus code!
Admin
JavaScript requires 0x at the beginning to treat it as a hexadecimal number.
Admin
TRWTF is parseInt instead of parseFloat
Admin
Maybe it was the beginning of the batman theme!
Admin
2,748 (I don't need no stinking 0x -- here is a fun one, when does a simple leading 0 cause confusion...)
Admin
2,748 (I don't need no stinking 0x -- here is a fun one, when does a simple leading 0 cause confusion...)
Admin
When printing a string! ;) (I know you're looking for octal)
Admin
Not the worst code I've seen today, and today so far I've only looked at this article and my own code... :)
Admin
A simple leading 0 will cause confusion when code that has been working fine for months breaks in August.
Because 8 is not a valid digit in an octal number.