challenge-algorithms-v2.0-a.../06-sum/index.js

10 lines
121 B
JavaScript
Raw Normal View History

export function sum(values) {
2022-11-02 17:50:03 +00:00
let sum = 0;
2022-11-02 14:59:41 +00:00
2022-11-02 17:50:03 +00:00
values.forEach((element) => {
sum += element;
});
2022-11-02 14:59:41 +00:00
2022-11-02 17:50:03 +00:00
return sum;
2022-11-02 14:59:41 +00:00
}