asked 190k views
2 votes
SetProperty("topButton", "background-color", "red");

setProperty("topButton", "background-color", "blue");
onEvent("topButton", "click", function() {
setProperty("topButton", "background-color", "green");
setProperty("topButton", "background-color", "orange");
});

If the user does NOT click the button what color will "topButton" be when the program finishes running?
a) red
b) blue
c) green
d) orange

1 Answer

2 votes

Final answer:

Without any clicks, the 'topButton' will be blue as the last setProperty called before the event handler changes it to blue.

Step-by-step explanation:

If the user does NOT click the "topButton", the color of "topButton" when the program finishes running will be blue. This is because the setProperty functions are called sequentially, changing the background color from "red" to "blue".

Since the button is not clicked, the event handler that would change the color to "green" and then to "orange" is not triggered.

answered
User CallumVass
by
7.8k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.