Skip to content

multiply

Multiplies two or more numeric values.

Syntax

typescript
multiply(...values: number[]): number

Parameters

NameTypeDescription
...valuesnumber[]Two or more numbers to be multiplied.

Return

TypeDescription
numberThe result of multiplying all values.

Example

typescript
multiply(2, 3); // 6
multiply(2, 3, 4); // 24
multiply(5); // 5
multiply(); // 1

Notes

  • Throws TypeError if any argument is not a number.
  • If no arguments are provided, returns 1 (the multiplicative identity).

References

Released under the MIT License.