javascript multiply arguments
const mul = (...args) => args.reduce((a, b) => a * b);
// Example
mul(1, 2, 3, 4); // 24function sum(...numbers) {
return numbers.reduce((accumulator, current) => {
return accumulator += current;
});
};
sum(1,2) // 3
sum(1,2,3,4,5) // 15
Also in JavaScript:
- loops javascript
- chrome-aws-lambda
- jquery get value of radio input
- jQuery exclude exteranl link for images
- npm windows shocut
- slide when mouse over gadget jquery
- javascript number to string
- regex optional whitespace characters
- vowels consonants javascript
- firebase react js
- toggle one class add and one class remove same time and after click remove class add and add class remove jquery
- rails call multiple variable format json
- find in string javascript
- how to create a variable javascript
- js obj
- how to delete element in array in javascript
- javascript absolute value
- beautiful day at the movies hackerrank solution
- angular one way property binding
- in react js how to access history in component
- upload photos cypress
- how to get width in javascript
- javascript map return array with distinc values
- javascript fastest loop