Category : clearinterval

I want my doSomething to be executed after some amount of time different than the interval of the setInterval, so I used setTimeout(doSomething, 5000); so I could call doSomething after say 5 seconds, but that doesn’t seem to happen. Regarding that I need to use clearInterval for the setInterval to stop executing in the condition ..

Read more

Good morning, i have some problems with clearing intervals. Here is my example of code: const count = document.getElementById(‘count’); let didStart = false; let countingNumber = 1; function startCounting(number) { setInterval(() => { const getNumber = parseInt(count.innerText); count.innerText = getNumber + number; }, 1000) } function resetCounting() { didStart = false; countingNumber = 2; console.log(‘DID ..

Read more

There is this code below, which is pretty straightforward: User scrolls into some section and that section is flagged with a CSS class "view" When I get to that specific section "someClsOfSection" I want to trigger adding 20 different classes to some element with setInterval Whenever I scroll the condition will be fulfiled and I ..

Read more