Skip to content

Instantly share code, notes, and snippets.

@myogeshchavan97
Last active November 19, 2019 07:05
Show Gist options
  • Save myogeshchavan97/ea912736e366f61dcaac6537cf30cce2 to your computer and use it in GitHub Desktop.
Save myogeshchavan97/ea912736e366f61dcaac6537cf30cce2 to your computer and use it in GitHub Desktop.
Get sum of numbers using rest operator
function addNumbers(...numbers) {
let sum = 0;
numbers.forEach(function(value) {
sum += value;
});
return sum;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment