JS Utils Kit
    Preparing search index...

    Function isTruthy

    • Checks whether a value is truthy.

      Falsy values include:

      • false
      • 0
      • "" (empty string)
      • null
      • undefined
      • NaN

      Type Parameters

      • T

      Parameters

      • value: T

        The value to check.

      Returns boolean

      true if the value is truthy, otherwise false.

      isTruthy(0);         // false
      isTruthy(''); // false
      isTruthy(null); // false
      isTruthy(undefined); // false
      isTruthy(NaN); // false
      isTruthy(1);         // true
      isTruthy('hello'); // true
      isTruthy([]); // true
      isTruthy({}); // true