Calculate

Calculate

  • Docs
  • Help
  • Blog

›Statistics

Getting Started

  • Installation
  • Updating Calculate

Math

  • Sum
  • Difference
  • Product
  • Quotient
  • Remainder
  • Power
  • Square
  • Cube
  • Factorial

Statistics

  • Mean
  • Median
  • Mode
  • Range

Range

Gets the range of given numbers or difference between the highest and the lowest number in a list.

Syntax

range(a: number, b: number, ...args): number

Parameters

a: number - First given number.

b: number - Second given number.

...args: number[] - The rest of the given numbers

Can be given an infinite number of parameters.

Returns

number - The resulting range.

Error

Throws an error if the length of arguments is less than 2.

Import

import { range } from '@princedev/calculate';

Examples

Basic usage with given numbers.

const result = range(21, 4, 8, 6);

result would be 17

If you're using an array, you can use the spread operator like this

const result = range(...[21, 4, 8, 6]);

result would be 17

Last updated on 5/6/2020 by Prince Neil Cedrick Castro
← Mode
  • Syntax
    • Parameters
    • Returns
    • Error
  • Import
  • Examples
Calculate
Docs
Getting StartedGuides
Package
NPMGitHubStar
More
HelpBlog
aws.cedi@gmail.com
Copyright © 2020 Calculate