📅  最后修改于: 2022-03-11 15:04:10.698000             🧑  作者: Mango
function sumNumbers(numbers) {
var sum = 0;
for (let i = 0; i < numbers.length; i++) {
var elements = numbers[i];
sum = sum + elements;
}
return sum;
}
const numbers = [2, 3, 4, 5, 2, 4];
console.log(sumNumbers(numbers));
//Output: 20