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
The Director's role in all this might be easier to understand if it did
something interesting. We'll start by having it show the Mole at a random time
mole.js
Define a method called scheduleShow that accepts a delay value
as its only argument. It should show the Mole using window.setTimeout
and the delay argument.
director.js
Replace the call to show in the Director's constructor with a call to scheduleShow. Use the Math.random function to make it a little
unpredictable. Remember: scheduleShow uses window.setTimeout, and that
expects the delay to be in number of milliseconds. Math.random returns
a random number between 0 and 1, so you'll have to write a small formula to
make the "right" random number.
The text was updated successfully, but these errors were encountered:
The Director's role in all this might be easier to understand if it did
something interesting. We'll start by having it show the Mole at a random time
mole.js
scheduleShow
that accepts adelay
valueas its only argument. It should
show
the Mole usingwindow.setTimeout
and the
delay
argument.director.js
show
in the Director's constructor with a call toscheduleShow
. Use theMath.random
function to make it a littleunpredictable. Remember:
scheduleShow
useswindow.setTimeout
, and thatexpects the delay to be in number of milliseconds.
Math.random
returnsa random number between 0 and 1, so you'll have to write a small formula to
make the "right" random number.
The text was updated successfully, but these errors were encountered: