Check if given input is truthy (so not 0, NaN, "", false, or nullish).
input
isTruthy(42); // trueisTruthy(true); // trueisTruthy(false); // falseisTruthy(0); // false Copy
isTruthy(42); // trueisTruthy(true); // trueisTruthy(false); // falseisTruthy(0); // false
Value to check.
Returns true if truthy, false otherwise.
true
false
Check if given
input
is truthy (so not 0, NaN, "", false, or nullish).Example