You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the specification, the game should end after 1 or 2 minutes. We'll
get into game "screens" later on, but for now, let's make sure the moles stop
appearing and print the score.
director.js
Define an endGame method on the Director prototype
Print the player performance information (whacCount and escapeCount) to the developer's console in the endGame method. You can
use the console.log method to do this.
Hide all the moles (only if they are currently visible). Make sure that
they don't get scheduled to automatically show themselves again!
Update the Director constructor to schedule the endGame method to
be invoked in one or two minutes (remember: use setTimeout)
Playing through a couple times, you may notice that some moles sometimes pop
up after the game is supposed to be over. Do you know why that is? Can you fix
it?
(This is a tricky one, so here's a hint: clearTimeout is a global function
that lets you cancel code you have already scheduled to run with setTimeout.
Read the docs on MDN for more info.)
The text was updated successfully, but these errors were encountered:
According to the specification, the game should end after 1 or 2 minutes. We'll
get into game "screens" later on, but for now, let's make sure the moles stop
appearing and print the score.
director.js
endGame
method on theDirector
prototypewhacCount
andescapeCount
) to the developer's console in theendGame
method. You canuse the
console.log
method to do this.they don't get scheduled to automatically show themselves again!
Director
constructor to schedule theendGame
method tobe invoked in one or two minutes (remember: use
setTimeout
)Playing through a couple times, you may notice that some moles sometimes pop
up after the game is supposed to be over. Do you know why that is? Can you fix
it?
(This is a tricky one, so here's a hint:
clearTimeout
is a global functionthat lets you cancel code you have already scheduled to run with
setTimeout
.Read the docs on MDN for more info.)
The text was updated successfully, but these errors were encountered: