computeSum(elements) {
Let i be set to 0
Let len equal to length of elements
Let sum be set to zero
While i is less than len
Let nextElement equal to the element in elements at index i
Let sum equal sum plus nextElem
Let i bet set to i plus 1
Return sum
}
function computeSum(elements) { let i = 0 let len = elements.length let sum = 0 while (i < len) { let nextElem = elements[i] sum += nextElem i += 1 } return sum } _hiddenSource_ //Try It let nums = [10, 20, 30, 40] let sum = computeSum(nums); println("Sum: " + sum);