Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. let interval = 0;
  2. let direction = 0;
  3.  
  4. setInterval(() => {
  5. if (direction === 0) {
  6. if (interval === 100) {
  7. direction = 1;
  8. return;
  9. }
  10. console.log(interval++);
  11. } else if (direction === 1) {
  12. if (interval === 0) {
  13. direction = 0;
  14. return;
  15. }
  16. console.log(interval--);
  17. }
  18. }, 50);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement