The times list has race times in seconds. When someone clicks the bestButton button, find the lowest time and show it in the bestLabel label.
The label shows Best time: 11.2.
11 strips: M1 to M11
if (times[i] < best) { M1var best = times[0]; M2var best = 0; M3onEvent("bestButton", "click", function() { M4var times = [12.4, 11.9, 13.1, 11.2, 12.8]; M5setText("bestLabel", "Best time: " + best); M6best = times[i]; M7for (var i = 1; i < times.length; i++) { M8} M9} M10}); M11Order: M5, M4, M2, M8, M1, M7, M10, M9, M6, M11. Extra: M3
var times = [12.4, 11.9, 13.1, 11.2, 12.8];
onEvent("bestButton", "click", function() {
var best = times[0];
for (var i = 1; i < times.length; i++) {
if (times[i] < best) {
best = times[i];
}
}
setText("bestLabel", "Best time: " + best);
}); Extra strip: var best = 0;. No time is lower than 0, so best never changes and the label shows Best time: 0.