how sum all array element with while loop
// 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()