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; }