Since js is single-threaded, are the functions executed in setTimeout concurrent? Whether it will affect the thread in progress

setTimeout( ()=>console.log(""), 1000);
function sayHello( arg ) {
    return new Promise ( (resolve, reject) => {
        if( arg === "success" ) {
            for( var i=0; i< 1000; iPP) {
                if(i===999)
                    resolve(i);
            }
        } else if( arg === "fail" ) {
            reject("");
        }
    })
}
console.log("");
sayHello( "success" ).then( arg => {
    console.log(arg)
})

I can"t quite understand this function all the time

if setTimeout has a shorter time setting, will it affect the for loop in Promise?

if setTimeout, is set, are the functions executed in this function executed concurrently?

Oct.25,2021

there is no concurrent execution, and the time you set to run at most in the next cycle is


. The time of setTimeout is not necessarily accurate. Will execute


after for maybe you need to understand the js execution mechanism
portal:
;
if helpful, please adopt

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-1eae7da-21dc.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-1eae7da-21dc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?