Last active
February 18, 2022 21:45
-
-
Save chaw-bot/4072068608cfe576048c0b20404bf721 to your computer and use it in GitHub Desktop.
Given an array of integers, find the sum of its elements. For example, if the array , , so return . Function Description Complete the simpleArraySum function in the editor below. It must return the sum of the array elements as an integer. simpleArraySum has the following parameter(s): ar: an array of integers Input Format The first line contains…
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 simpleArraySum(ar) { | |
let sum = 0 | |
ar.map((num) => { | |
sum += num; | |
}); | |
return sum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment