Skip to content

Instantly share code, notes, and snippets.

@M3kH
Created Mar 26, 2017
Embed
What would you like to do?
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