Computes the signed length of the given range.

Type signature

([min, max]: [number, number]) => number

Examples

length([3, 15]);
// ⇒ 12
Try in REPL
length([1, 0]);
// ⇒ -1
Try in REPL

Questions

  • How to compute a signed length of a range?

TypeScript sourceJavaScript source