-
-
Save himeshvats19/ac6384b9ba95c248cce9e2ab3787bf4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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