Promise principle and setTimeout sequence problem

see many promise implementations on the Internet using setTimeout to adjust the execution order
since they are all based on setTimeout, why is promise faster than setTimeout?

I understand the difference between micro and macro tasks
but isn"t promise based on setTimeout?

Jul.14,2021

clipboard.png

promise is promise, setTimeout is setTimeout, but in some cases, for example, if the browser does not support promise, use setTimeout to cover the bottom. For example, nextTick


native promise in vue does not need setTimeout


Promise is a solution for asynchronous programming. It was first proposed and implemented by the community, and ES6 wrote it into the language standard, unified usage, and natively provided Promise objects. http://es6.ruanyifeng.com/-sharpdo.


setTimeout only simulates the asynchronous process, and Promise is used to solve asynchronous processing

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