3 ms·
How to Compose JavaScript Functions That Take Multiple Parameters
- chetan_187 2y agoAre you talking about the var argument functions or the function which takes definite parameters? Function with Var Args - function sum(...numbers) { return numbers.reduce((total, number) => total + number, 0); } console.log(sum(1, 2, 3, 4, 5)); // Output: 15 Function with 2 Parameters - function calculateArea(length, width) { return length * width; } console.log(calculateArea(5, 10)); // Output: 50