Javascript – trying sum loop inside of a function
let amd = 'c'; const arr = ['a', 'b', 'c']; function getsum(acc, arr) { for (i = 0; i < arr.length; i++) { return acc = acc + arr[i]; } } console.log(getsum(amd, arr)); Could someone please explain why it gives…