Skip To Main Content

JS Truthiness

Posted by Sam Clearman

Jun 08 2010
 '0' && ('0' == false)
// true

We’ll just have to agree to disagree, javascript.


{: .space}

Update: this is what I mean by “truthy” and “falsy”:

function truthy(x) { return !!x; };
function falsy(x) { return !x; };
Posted by
Sam Clearman
on June 8th, 2010

Tagged in

Comments

We moved off of Disqus for data privacy and consent concerns, and are currently searching for a new commenting tool.

Contact Us

We'd love to hear from you. Get in touch!