Checks if all the given values have the same sign.

Type signature

(xs: number[]) => boolean

Examples

sameSign([-1, -2, -3]);
// ⇒ true
Try in REPL
sameSign([1, 2, -3]);
// ⇒ false
Try in REPL

Questions

  • How to check if all values have the same sign?

TypeScript sourceJavaScript source