Check if a number is positive
JavaScript
const isPositive = (n) => Math.sign(n) === 1
TypeScript
const isPositive = (n: number): boolean => Math.sign(n) === 1
Examples##
isPositive(3) // true
isPositive(-8) // false
const isPositive = (n) => Math.sign(n) === 1
const isPositive = (n: number): boolean => Math.sign(n) === 1
isPositive(3) // true
isPositive(-8) // false