Created
September 25, 2019 00:21
-
-
Save johnhutchins/d9ac5718fa799a9af1f4a3bbd507eb93 to your computer and use it in GitHub Desktop.
adds items from a passed in arr and returns the total
This file contains hidden or 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
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