forked from M3-Academy/challenge-algorithms-v2.0
Merge branch 'feature/sumEven'
This commit is contained in:
commit
c41078cac6
@ -1,4 +1,12 @@
|
||||
export function sumEven(value) {
|
||||
// implementar logica aqui
|
||||
|
||||
}
|
||||
if (value.length == 0 || value.length == 1) return 0;
|
||||
let result = 0;
|
||||
|
||||
value.forEach((item, index) => {
|
||||
if (item % 2 == 0) {
|
||||
return (result = result + item);
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user