Answers for "can you use rest operator and add array of numbers"

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
-2

spread and rest operator javascript

function myData(...args){console.log(args) ; // ["Marina",24,"Front-End Developer"]}myData("Marina",24,"Front-End Developer") ;
Posted by: Guest on June-25-2020

Code answers related to "can you use rest operator and add array of numbers"

Code answers related to "Javascript"

Browse Popular Code Answers by Language