Guest User

Untitled

a guest
Jul 17th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1.  
  2. // continuations! lulz
  3.  
  4. function dostuff(param, cont)
  5. {cont=cont||1;function pause(msec){setTimeout(function(){dostuff(param,cont+1);},msec);}switch(cont){
  6.  
  7. case 1:
  8.  
  9. // first part of function goes here
  10. alert(param.name+" is a lame-o.");
  11.  
  12. return pause(1000);
  13. case 2:
  14.  
  15. // second part of function goes here
  16. alert("Balls about "+param.name+" continues.");
  17.  
  18. return pause(1000);
  19. case 3:
  20.  
  21. // third part of function goes here
  22. alert("More crap about "+param.name+".");
  23.  
  24. }}
  25.  
  26. dostuff({name: 'Lamer'});
Add Comment
Please, Sign In to add comment