Created
May 13, 2018 17:46
-
-
Save dg92/d18524d0b0aec2d0ab23c26b263a96bc 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
// to calculate the sum of array elements | |
const sum = (arr) => { | |
let result = 0; | |
for (let i = 0; i < arr.length; i++) { | |
result += arr[i]; | |
} | |
return result; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment