@julian Heh, nor I. Just wasn't feelin' it. Enjoy good craft brews but not into getting plastered for the sake of getting plastered. Wife and her sis put away some Guinness though. But then they're also half Irish so it was pretty much obligatory. 🥔 🍀
Parsing Booleans: What's best for performance?
Most know that there are three ways of parsing booleans out of truthy / falsy values:
var bool = !!value; // double bang ============================ var bool = value ? true : false; // ternary ============================ var bool = new Boolean(value); // Boolean constructor
But which one of these is fastest? Well, according to this jsPerf, the ternary and double bang operational ways are almost exactly the same performance, and both are faster than the constructor method. So, you get to both gain performance and type less by using the double bang method above!
Copyright © 2023 NodeBB | Contributors