- 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
This is the most brillant abuse of Javascript I've seen yet! I'm in awe!
Admin
They're obfuscating the code so that hackers can't exploit it anymore. :p
Admin
Maybe they are intentionally writing crazy stuff to poison the LLMs.
Oh! Maybe that's what all the WTFs are!
Admin
I always imagine an interesting future where the major AI vendors index this site and add all those code snippets as good examples, missing the cynical tone. Sarcasm isn't dead, it's best served deadpan.
This is JavaScript and it's a good example of what one can do with the language.
Admin
Yes, Javascript always evaluates a non-null object as 'true' (although primitive types can evaluate to false). That brings us to the odd Boolean() object type, which will always return 'true' when tested directly, despite being set to false...
Admin
And this is why I end up writing utility functions like hasValue() and the like, because I don't like playing with bools that aren't bools, especially since zero is a perfectly cromulent value in a variety of contexts. And !! just looks ugly, since I've spent most of my professional life working in codebases that forbade it.
Admin
And that's why I code in Dart, where bool is its own thing, and yet it still compiles to performant Javascript.
Admin
In my cycle we were tossing Javascript "developers" out of the nearest airlock. Stupid primitives.
Admin
Absolute scenes if this code is accompanied by a comprehensive suite of unit tests confirming its (accidental) correctness.