[Home] >  Number >  Multiply arguments

Multiply arguments

JavaScript version

const mul = (...args) => args.reduce((a, b) => a * b);

TypeScript version

const mul = (...args: number[]): number => args.reduce((a, b) => a * b);

Examples

mul(1, 2, 3, 4); // 24