📅  最后修改于: 2022-03-11 14:55:24.990000             🧑  作者: Mango
let numStr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const sumEvens = (numStr) => {
let sum = 0;
for (let i = 0; i < numStr.length; i++) {
if (i % 2 === 0){
sum = sum + numStr[i];
}
}
return sum;
}
console.log(sumEvens(numStr));