challenge-algorithms-v2.0_c.../07-sumEven/index.js

9 lines
161 B
JavaScript
Raw Normal View History

export function sumEven(value) {
2022-10-28 17:12:04 +00:00
let result = 0;
for(let i = 0; i <= value.length; i++){
if(i % 2 === 0){
result += i;
}
}
return result;
}