```
const arr = [5,1,3,2,6];
const output = arr.reduce(function (acc, curr){
acc = acc + curr;
return acc;
}, 0);
console.log(output);
```
since there is return statement there, why the reduce function keeps iterating as return statement ends any loop or function as per my knowledge.