Advertisement
pain2theworld

Untitled

Nov 19th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  7. <title>Zad 01</title>
  8. <script>
  9. var taskete = 1;
  10.  
  11. var handler = function(count) {
  12. var caller = arguments.callee;
  13.  
  14. //Infinite
  15. if (count == -1) {
  16. window.setTimeout(function() {
  17. console.log(taskete);
  18. taskete++;
  19. caller(count);
  20. }, 1000);
  21. }
  22.  
  23. if (count > 0) {
  24. if (count == 0) return;
  25. console.log(taskete);
  26. taskete++;
  27. window.setTimeout(function() {
  28. caller(count - 1);
  29. }, 100);
  30. }
  31.  
  32. if (count == null) {
  33. console.log(taskete);
  34. taskete++;
  35. }
  36. };
  37.  
  38. handler(10);
  39. </script>
  40. </head>
  41. <body></body>
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement