Skip to content

Instantly share code, notes, and snippets.

@M3kH
Created March 26, 2017 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save M3kH/0c5fd30225a188a82ae3234d75fec051 to your computer and use it in GitHub Desktop.
Save M3kH/0c5fd30225a188a82ae3234d75fec051 to your computer and use it in GitHub Desktop.
Controlling While loops
function ABlockingFunction( stopAtTime ){
var StartAt = new Date();
var animation = ['Running...'];
while( StartAt <= stopAtTime ){
StartAt = new Date();
animation.push('.')
console.log(animation.join(''));
}
return this;
}
var stopAt = new Date();
stopAt.setMinutes(stopAt.getMinutes() + 1);
ABlockingFunction(stopAt);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment