Calculate

Calculate

  • Docs
  • Help
  • Blog

›Math

Getting Started

  • Installation
  • Updating Calculate

Math

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

Statistics

  • Mean
  • Median
  • Mode
  • Range

Factorial

Gets the factorial of a given number.

Syntax

factorial(a: number): number

Parameters

a: number - Given number to be evaluated.

Returns

number - The resulting number.

Error

Throws an error if the length of arguments is not equal to 1.

Import

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

Examples

Basic usage, getting the factorial of 0 and 1

const result = factorial(0);

result would be 1

const result = factorial(1);

result would be 1

Getting the factorial of any numbers greater than 1

const result = factorial(4);

result would be 24

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