Can setTimeout execute more than one?

for example:

    setTimeout(function(){
            $(".abc").removeClass("a");
        },5000);
    setTimeout(function(){
            $(".abc").removeClass("b");
        },3000);
        
The

requirement is that if the second setTimeout is executed before the first setTimeout is executed, will the first setTimeout be overwritten? If so, is there any other way? Thank you!


is not overwritten, they are two anonymous asynchronous executions, and each has its own scope


there are no overrides. In general, the execution order is first arranged according to the time parameters given by the timer, and if the time is the same, it is arranged in the order of the code statements.


each execution does not understand what you are trying to say


run

after 3 seconds
removeClass ('b')

wait another two seconds

removeClass ('a')

related issues relate to async .


Brother, the first time parameter of your two timeout calls is different, so there is no coverage problem. Secondly, the event module of js is asynchronous.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e3a794-445b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e3a794-445b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?