You are viewing a single comment's thread. Return to all comments →
You need to save "i" as a variable like below
function simpleArraySum(ar) { var ans = 0; for (var i = 0; i < ar.length; i++) { ans += ar[i]; } return ans; }
Seems like cookies are disabled on this browser, please enable them to open this website
Simple Array Sum
You are viewing a single comment's thread. Return to all comments →
You need to save "i" as a variable like below
function simpleArraySum(ar) { var ans = 0; for (var i = 0; i < ar.length; i++) { ans += ar[i]; } return ans; }