Skip to content

Instantly share code, notes, and snippets.

@himeshvats19
Created June 26, 2019 07:18
Show Gist options
  • Save himeshvats19/ac6384b9ba95c248cce9e2ab3787bf4e to your computer and use it in GitHub Desktop.
Save himeshvats19/ac6384b9ba95c248cce9e2ab3787bf4e to your computer and use it in GitHub Desktop.
function fun(…input){
let sum = 0;
for(let i of input){
sum+=i;
}
return sum;
}
console.log(fun(1,2)); //3
console.log(fun(1,2,3)); //6
console.log(fun(1,2,3,4,5)); //15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment