A question about promise

topic description

let _resolve;
let promise2 = new Promise((resolve, reject) => _resolve = resolve);

promise2.then((data)=>{
    console.log(data);
})
setTimeout(()=>{
    _resolve(2000000000);
},7000)
The execution result of

code?

Why is this?

Jul.28,2021

wait 7 seconds to print 2000000000, because it takes 7 seconds for you to let it complete


Brother you mean that the assignment has no parentheses, that is, it is not executed. The real execution is in the timeout call. All successful callbacks are that the data will receive this data, and the hope from the timeout call will help you

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