Promise = const new new Promise ((Resolve, Reject) => { the console.log ( . 1 ); Resolve (); the console.log ( 2 ); }) promise.then (() => { the console.log ( . 3 ); }) the console.log ( . 4);
the above output result 1243
is first performed immediately after the new Promise, it will first output 1, while Promise.then () internal code when executed immediately at the end of the event cycle times, it will be first output 4, the final output 3.
promise and face questions of principle
Guess you like
Origin www.cnblogs.com/dylAlex/p/11093168.html
Recommended
Ranking