Function isPowerOfTwo

  • Checks if a given number is a power of two.

    Parameters

    • n: number

      The number to check.

    Returns boolean

    'true' if the number is a power of two, 'false' otherwise.

    Static

    Example

    isPowerOfTwo(4);     // Returns true
    isPowerOfTwo(10); // Returns false
  • Checks if a given bigint is a power of two.

    Parameters

    • n: bigint

      The bigint to check.

    Returns boolean

    'true' if the bigint is a power of two, 'false' otherwise.

    Static

    Example

    isPowerOfTwo(4n);     // Returns true
    isPowerOfTwo(10n); // Returns false

Generated using TypeDoc