http://www.sitepoint.com/javascript-truthy-falsy/ function assert(condition, message) { if (!condition) { throw message || "Assertion failed"; } } // XXX == false // // falsy assert(!(false)); assert(!(0)); assert(!("")); assert(!(null)); assert(!(undefined)); assert(!(NaN)); // truthy assert(!!("0")); assert(!!("false")); // empty functions // empty array // empty object