var sum = 0; for(var i=0; i<arr.length; i++){ if(arr[i] > arr[1]){ console.log(arr[i]); sum += arr[i]; } } return sum; }