[Home] >  Number >  Calculate the remainder of division of arguments

Calculate the remainder of division of arguments

JavaScript version

const remainder = (...args) => args.reduce((a, b) => a % b);

TypeScript version

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

Examples

remainder(1, 2, 3, 4); // 1