Skip to content

isFalsy ​

The isFalsy function checks if the provided value is considered falsy in JavaScript.

Syntax ​

typescript
isFalsy(value: any): boolean;

Parameters ​

ParameterTypeDescription
valueanyValue to be checked

Returns ​

TypeDescription
booleanTrue if it is a falsy value

Examples ​

typescript
isFalsy(0); // => true
isFalsy(""); // => true
isFalsy(null); // => true
isFalsy(undefined); // => true
isFalsy(false); // => true
isFalsy(NaN); // => true
isFalsy(1); // => false

Notes ​

  • Falsy values include: false, 0, "", null, undefined, NaN.

References ​

Released under the MIT License.