When someone clicks the averageButton button, add up the numbers in the scores list, then show the average in the averageLabel label.
The label shows Average: 83.6.
10 strips: K1 to K10
total = total + scores[i]; K1setText("averageLabel", "Average: " + average); K2total = total + i; K3}); K4var scores = [88, 92, 75, 64, 99]; K5var total = 0; K6onEvent("averageButton", "click", function() { K7var average = total / scores.length; K8} K9for (var i = 0; i < scores.length; i++) { K10Order: K5, K7, K6, K10, K1, K9, K8, K2, K4. Extra: K3
var scores = [88, 92, 75, 64, 99];
onEvent("averageButton", "click", function() {
var total = 0;
for (var i = 0; i < scores.length; i++) {
total = total + scores[i];
}
var average = total / scores.length;
setText("averageLabel", "Average: " + average);
}); Extra strip: total = total + i;. i is the index, not the score. This adds 0 + 1 + 2 + 3 + 4, so the average is 2.