Pages

Tuesday, October 4, 2016

You complete me - stop (JavaScript)

Use the code presented in Timer (JavaScript) and add some code to the partially complete function below to complete it. (Did I have you at hello?)
/*
 * pause does nothing for timeInMs millisends
 * before returning control to the code that
 * called pause. Internally, pause uses a
 * Timer object to wait the specified
 * amount of time before completing.
 */
function pause(timeInMs) {
  // Missing code starts here:

  // Missing code ends here.
  while (timer.elapsedTimeInMs() < timeInMs);
}