How do I correctly use setInterval and clearInterval to switch between two different functions?

前端 未结 6 440
-上瘾入骨i
-上瘾入骨i 2020-12-01 12:53

For practice I am trying to display a number that increments from 0 - 9, then decrements from 9 - 0, and infinitely repeats.

The code that I have so far seems to

6条回答
  •  借酒劲吻你
    2020-12-01 13:17

    try this:

    ...
    
    
        
    
        From 0 - 9, up and down:  

    you could also create a single reference to #here element. Use always === instead of ==

提交回复
热议问题