Answers for "is there any difference between the reduce function and the spread of values operator in js"

7

the rest operator javascript

function sum(...numbers) {
	return numbers.reduce((accumulator, current) => {
		return accumulator += current;
	});
};
 
sum(1,2) // 3
sum(1,2,3,4,5) // 15
Posted by: Guest on January-14-2020
6

.reduce mdn

arr.reduce(callback( accumulator, currentValue[, index[, array]] )[, initialValue])
Posted by: Guest on March-11-2020

Code answers related to "is there any difference between the reduce function and the spread of values operator in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language