const arr =[1, 2, 3]
function getSum(list) {
let sum = 0;
for (let i = 0; i < list.length; i++) {
sum = sum + list[i];
}
return sum;
}
console.log(getSum([arr]));
Created
June 17, 2021 05:10
-
-
Save tripdog/141d5ccc60565277a672403b3f411f2d to your computer and use it in GitHub Desktop.
Create a function that takes in a list and find the sum of all the numbers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment