📅  最后修改于: 2022-03-11 15:04:18.158000             🧑  作者: Mango
// define a list
const list = [1,2,3,4,5];
// arrow function to sum array element
const result2 = () => {
var i = list.length;
var sum = 0;
while (i--) {
sum += list[i]
}
console.log(sum)
}
result2()