5 kyu
Javascript Magic Function
506 of 540candrabeqx
Description:
Create function that:
- accepts any number of parameters,
- returns sum of every single parameter given,
- any parameter that can not be parsed as a number will be counted as 0.
- can be called infinitely,
- the next function call will do the same thing, but also summing the last returned number.
MagicFunction(3) == 3; // should return true
MagicFunction(1, 2) == 3; // should return true
MagicFunction(1, 3)(2) == 6; // should return true
MagicFunction(1, 2)(3, 4, 5)(6)(7, 10) == 38; // should return true
Language Features
Functional Programming
Similar Kata:
Stats:
Created | Aug 12, 2015 |
Published | Aug 12, 2015 |
Warriors Trained | 2022 |
Total Skips | 233 |
Total Code Submissions | 10562 |
Total Times Completed | 540 |
JavaScript Completions | 506 |
Total Stars | 83 |
% of votes with a positive feedback rating | 88% of 106 |
Total "Very Satisfied" Votes | 89 |
Total "Somewhat Satisfied" Votes | 8 |
Total "Not Satisfied" Votes | 9 |