Skip to content

Instantly share code, notes, and snippets.

@Ajax30
Last active September 7, 2020 10:51
Show Gist options
  • Save Ajax30/3efe676b607b604eb7f5b0587d4f4d75 to your computer and use it in GitHub Desktop.
Save Ajax30/3efe676b607b604eb7f5b0587d4f4d75 to your computer and use it in GitHub Desktop.
function addArrayMembers(arr) {
sum = 0;
arr.forEach(function(el, index) {
return sum = sum + arr[index];
});
return sum;
}
var arr = [1, 3, 5, 7];
addArrayMembers(arr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment