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