funjs / book-source

The example source code for the book Functional JavaScript by Michael Fogus, published by O'Reilly
Other
349 stars 101 forks source link

truthy fn #11

Open ecasilla opened 9 years ago

ecasilla commented 9 years ago

Im not sure if this is the correct implementation of the truthy function as 0 & ' ' are both falsey values in javascript which is confusing..

I think you should use the boolean operator to tell if the value is truthy

function truthy(x){ return !!x; }