2022-10-27 15:07:13 +00:00
|
|
|
export function sumEven(value) {
|
2022-11-02 22:15:45 +00:00
|
|
|
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;
|
|
|
|
}
|