7 kyu
Sum The Array
1,191 of 1,194vasekhlav
Description:
Your job is to add a method 'sum' to all array objects, which sums all the numbers in it. You should return 0 if the array is empty.
For example:
var arr = [1,2,3,4];
arr.sum(); //returns 10
var arr = [10, 28, 14, 33];
arr.sum(); //returns 85
Good luck!
Arrays
Fundamentals
Similar Kata:
Stats:
Created | Feb 12, 2016 |
Published | Feb 12, 2016 |
Warriors Trained | 2719 |
Total Skips | 77 |
Total Code Submissions | 3617 |
Total Times Completed | 1194 |
JavaScript Completions | 1191 |
CoffeeScript Completions | 18 |
Total Stars | 30 |
% of votes with a positive feedback rating | 93% of 231 |
Total "Very Satisfied" Votes | 200 |
Total "Somewhat Satisfied" Votes | 28 |
Total "Not Satisfied" Votes | 3 |