40 ms·
Regarding the "bangbang" operator: I agree that the syntax is overly cute and frustratingly confusing to new users of the language, but I still find I often wan
by WorldMaker 6y ago
Regarding the "bangbang" operator: I agree that the syntax is overly cute and frustratingly confusing to new users of the language, but I still find I often want a "not falsy" operation. I've moved to using the `Boolean(variableToCheck)` pattern. It's certainly far more characters to type (without autocomplete) than the pithy double not "bangbang", but benefits from being explicit in what it is doing and benefits from some small performance fast paths in some JS engines over !!. (Micro-optimizations like that are rarely a good primary reason to switch to a different tool, but it's a nice side benefit from all the other reasons including and especially making the code easier to read.)