All puzzles
Per page
B
onEvent · setProperty · setText

Light the lamp

Write the redButton button's onEvent first, then the offButton button's. Each one sets the background color of the lamp element and says what happened in the statusLabel label.

After a click on the redButton button, the lamp element is red, and the statusLabel label says "The lamp is red."

9 strips: B1 to B9

setProperty("lamp", "background-color", "red");
B1
});
B2
});
B3
setProperty("lamp", "background-color", "black");
B4
setText("statusLabel", "The lamp is red.");
B5
setProperty("lamp", "text-color", "red");
B6
onEvent("redButton", "click", function() {
B7
onEvent("offButton", "click", function() {
B8
setText("statusLabel", "The lamp is off.");
B9

Answer key: B. Light the lamp

Order: B7, B1, B5, B2, B8, B4, B9, B3. Extra: B6

Lines with the same mark can go in either order.

onEvent("redButton", "click", function() {
	setProperty("lamp", "background-color", "red");
	setText("statusLabel", "The lamp is red.");
});
onEvent("offButton", "click", function() {
	setProperty("lamp", "background-color", "black");
	setText("statusLabel", "The lamp is off.");
});

Extra strip: setProperty("lamp", "text-color", "red");. "text-color" changes the color of the text on the lamp, not its background. The lamp itself stays the same color.