Skip to content

isPositive

The isPositive function checks if a number is positive.

Syntax

typescript
isPositive(value)

Parameters

NameTypeDescription
valuenumberNumber to be checked.

Return Value

TypeDescription
booleantrue if the number is positive, else false.

Examples

typescript
isPositive(10); // true
isPositive(0);  // false
isPositive(-5); // false

Notes

  • Throws a TypeError if the value is not a number.
  • Useful for mathematical and logical validations.

References

Released under the MIT License.