All puzzles
Per page
D
Variable outside onEvent ยท if

Tap to win

Count the clicks on the tapButton button in the taps variable. Show the count in the countLabel label. From the 10th click on, the label shows "You win!" instead.

After 3 clicks, the label shows Taps: 3. After 10, it shows You win!.

9 strips: D1 to D9

setText("countLabel", "Taps: " + taps);
D1
taps = taps + 1;
D2
});
D3
}
D4
onEvent("tapButton", "click", function() {
D5
if (taps >= 10) {
D6
setText("countLabel", "Taps: " + "taps");
D7
setText("countLabel", "You win!");
D8
var taps = 0;
D9

Answer key: D. Tap to win

Order: D9, D5, D2, D1, D6, D8, D4, D3. Extra: D7

var taps = 0;
onEvent("tapButton", "click", function() {
	taps = taps + 1;
	setText("countLabel", "Taps: " + taps);
	if (taps >= 10) {
		setText("countLabel", "You win!");
	}
});

Extra strip: setText("countLabel", "Taps: " + "taps");. In quotes, "taps" is just the word taps, not the taps variable. The label always shows Taps: taps.