multiply
Multiplies two or more numeric values.
Syntax
typescript
multiply(...values: number[]): numberParameters
| Name | Type | Description |
|---|---|---|
...values | number[] | Two or more numbers to be multiplied. |
Return
| Type | Description |
|---|---|
number | The result of multiplying all values. |
Example
typescript
multiply(2, 3); // 6
multiply(2, 3, 4); // 24
multiply(5); // 5
multiply(); // 1Notes
- Throws
TypeErrorif any argument is not a number. - If no arguments are provided, returns 1 (the multiplicative identity).
