Skip to content

Instantly share code, notes, and snippets.

@johnhutchins
Created September 25, 2019 00:21
Show Gist options
  • Save johnhutchins/d9ac5718fa799a9af1f4a3bbd507eb93 to your computer and use it in GitHub Desktop.
Save johnhutchins/d9ac5718fa799a9af1f4a3bbd507eb93 to your computer and use it in GitHub Desktop.
adds items from a passed in arr and returns the total
function add(arr){
let total = 0;
arr.forEach(function(num){
console.log(num);
total += Number.parseInt(num);
});
console.log(total);
return total;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment