Flutterby™! : JavaScript idioms

Next unread comment / Catchup all unread comments User Account Info | Logout | XML/Pilot/etc versions | Long version (with comments) | Weblog archives | Site Map | | Browse Topics

JavaScript idioms

2023-09-13 20:00:17.639384+02 by Dan Lyke 0 comments

RT Greg Knauss @gnkauss@mastodon.social

Since I’m new to JavaScript, I wrote:

    𝚒𝚏 (𝚌𝚊𝚕𝚕𝚋𝚊𝚌𝚔) { 𝚌𝚊𝚕𝚕𝚋𝚊𝚌𝚔(); }

…like an idiot. Then, I realized I should be adapting to JavaScript culture and make it inscrutable, so I re-wrote the line to:

    𝚌𝚊𝚕𝚕𝚋𝚊𝚌𝚔 && 𝚌𝚊𝚕𝚕𝚋𝚊𝚌𝚔();

But I suspected there was something even more nightmarish, and sure enough, of course. This is how real[Wiki] JavaScript developers do it:

    𝚌𝚊𝚕𝚕𝚋𝚊𝚌𝚔?.();

And by “real JavaScript developers,” I mean “monsters”.

[ related topics: Invention and Design moron Sociology California Culture ]

comments in ascending chronological order (reverse):