4 ms·
I looked at this page first and assumed that it was all a gag. https://javascript.info/ninja-code https://javascript.info/ninja-code >Show your original think
by jonnycomputer 6y ago
I looked at this page first and assumed that it was all a gag.
https://javascript.info/ninja-code https://javascript.info/ninja-code
>Show your original thinking! Let the call of checkPermission return not true/false, but a complex object with the results of the check.
>Those developers who try to write if (checkPermission(..)), will wonder why it doesn’t work. Tell them: “Read the docs!”. And give this article.
- weaksauce 6y agoIt was tongue in cheek though... the summary tells you as much.
- jonnycomputer 6y agoI mean, I read it, and assumed the rest of the guide was also tongue in cheek.
- SamBam 6y agoEvery single example on that page was clear bunk -- showing the worst habits of some developers, and making clear why they are terrible. I think if you've gotten as far as that chapter, it would be pretty impossible not to realize it was tongue in cheek. At the top of the page is a big warning triangle that says "Irony detected." No other chapter includes such a prominent warning. I think it's pretty clear that the "gag" is specific to that chapter.
- z3t4 6y agoThen it will always be truthly if it returns an object, or 0 means success? :) The proper way is callback convention err. Then you can write if(!err) ...