Skip to content

Function: factorial() ​

ts
function factorial(n): number;

Factorial n!. 阶乘 n!。

Parameters ​

ParameterTypeDescription
nnumberNon-negative integer / 非负整数

Returns ​

number

Factorial / 阶乘结果

Example ​

ts
factorial(5) // => 120

Since ​

1.0.0

Released under the MIT License.