by BlastRoom
Practice attaching JavaScript handlers that respond to user actions.
#computer_science

25 questions
One question set, multiple game modes. Tap any game to see it in action. Not sure which to pick?
Answer to place stones and capture territory.
Outrun the snow together.
Earn blasts, then hunt the other team.
Answer to earn energy, then climb.

The class blasts through walls together.
Bid on mystery lots. Most money wins.
Sell tours. Nice, standard, or a total scam.
Answer, restock, and serve the rush.
More correct answers pulls the rope your way.
Answer, then shoot down the alien wave.
Answer, then tap to leap the frozen ridge.
A quiz page has a form. When the visitor tries to send the form with an empty answer, a handler must show a warning and prevent the browser from moving to the results page. Which event should the handler listen for?
A search box should update a message showing the number of characters immediately whenever its text value changes. Which event does the page need?
A page has a dropdown menu, and its details panel should update after the visitor chooses a different option. Which event should run the update?
A page must fill in today's greeting as soon as the page has finished loading, before the visitor interacts with any element. Which event should trigger that code?
A password field should reveal a short hint at the moment the visitor places the text cursor in that field. Which event is needed?
A form should check whether an email address has an @ symbol after the visitor leaves the email field. Which event best matches that moment?
A game page must block the browser's usual action when the visitor presses the Enter key in a text field. Which event should the handler use to detect the key before that action occurs?
A page has Start and this script: let count = 0; document.getElementById("go").addEventListener("click", function() { count = count + 1; console.log(count); }); The visitor clicks Start three times. What appears in the console?
A page contains Add and this script: let total = 5; document.getElementById("add").addEventListener("click", function () { total = total + 2; console.log(total); }); The visitor presses Add twice. What appears in the console?
A page has Light and this script: let on = false; document.getElementById("light").addEventListener("click", function() { on = !on; console.log(on); }); The visitor clicks Light three times. What appears in the console?
A page has Vote and this script: let votes = 0; document.getElementById("vote").addEventListener("click", function() { console.log(votes); votes = votes + 1; }); The visitor clicks Vote twice. What appears in the console?
A page contains Next and this script: let page = 1; document.getElementById("next").addEventListener("click", function () { page++; console.log("Page " + page); }); The visitor presses Next twice. What appears in the console?
A page has Score and script: let points = 10; document.getElementById("score").addEventListener("click", function() { points = points - 3; console.log(points); }); Score is clicked three times. What appears in the console?
A page contains Waiting and Go. A function named showMsg is already defined. Which line makes pressing Go run showMsg?
A page contains and a function named checkName. Which statement attaches checkName so it runs whenever the input's value changes?
A page contains and a function named validate. Which line attaches validate to the form's submit event?
A page contains Help and a function named openHelp. Which line correctly makes the button run openHelp when clicked?
A page contains and a function named showHint. Which line makes showHint run when the field receives focus?
A page contains Press and this script: function greet() { console.log("Hi"); } document.getElementById("btn").addEventListener("click", greet()); The page loads, then the visitor presses Press twice. What happens?
A page has Save and script: let saved=0; function record(){ saved=saved+1; console.log(saved); } document.getElementById("save").addEventListener("click", record()); Page loads, then Save is clicked. What appears in the console?
A page contains Menu and this script: function showMenu() { console.log("Open"); } document.getElementById("menu").addEventListener("click", showMenu()); Why does the code fail to save showMenu as the button's handler?
A page contains Close and this script: function leave() { console.log("Closing"); } document.getElementById("close").addEventListener("click", leave()); Which change makes Closing appear only when Close is pressed?
A page contains Save and Quit, plus this script: document.getElementById("quit").addEventListener("click", function () { console.log("Goodbye"); }); Which action puts Goodbye in the console?
A page contains and , plus this script: document.getElementById("email").addEventListener("blur", function () { console.log("Check field"); }); Which action logs Check field?
A page contains Red and Blue, plus this script: document.getElementById("red").addEventListener("click", function () { console.log("Color selected"); }); Which visitor action runs this handler?
Crack the passcode before the zombies get in.
Answer, then swat bugs for bonus points.
Race through questions at your own speed.
Same question on every screen. Fastest wins.

Pick a tile, answer, hit bonuses and steals.
Collecting, Cleaning and Storing Data
25 questions