0

[SOLVED] How to cancel previous setTimeout when new setTimeout is call

I want to cancel previous setTimeout function in myFunction when myFunction run for second times https://code.sololearn.com/WZ10v4LHvdrj/?ref=app

19th Apr 2022, 12:26 AM
EsaKurniawan
4 Antworten
+ 2
use clearTimeout() 👇👇👇 https://code.sololearn.com/WUu3LQThxTA4/?ref=app
19th Apr 2022, 3:14 AM
NonStop CODING
NonStop CODING - avatar
+ 2
Thanks man for helping, even though your solution is not the exactly what i want, but it's give me the idea how to solved the problem. Here's is the code that working like i wanted to: https://code.sololearn.com/WTn183cIwDJp/?ref=app
19th Apr 2022, 9:15 AM
EsaKurniawan
+ 1
EsaKurniawan your welcome, i thought i understood your question well🤔👍
19th Apr 2022, 9:49 AM
NonStop CODING
NonStop CODING - avatar
+ 1
the question is little bit unclear though, what i really mean is that, when myFunction has been run and that function run again and then clear the previous setTimeout
19th Apr 2022, 10:08 AM
EsaKurniawan