In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge points of this article "what are the Promise FAQs of JavaScript?", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "what are the Promise FAQs of JavaScript?"
Q: can then, catch and finally sequences be reversed?
A: yes, the effect is exactly the same. However, this is not recommended, and it is best to write programs in the order of then-catch-finally.
Q: apart from then blocks, can the other two blocks be used multiple times?
A: yes, finally executes sequentially like then, but the catch block only executes the first, unless there is an exception in the catch block. So it's best to arrange only one catch and finally block.
Q: how does the then block break?
A: then blocks are executed sequentially downwards by default, and return cannot be interrupted. You can jump to catch through throw to achieve interruption.
Q: when is it appropriate to use Promise instead of traditional callback functions?
A: it is suitable for Promise when you need to perform multiple asynchronous operations sequentially, for example, if you want to detect the user name and password successively through the asynchronous method, you need to detect the user name first and then the password asynchronously.
Q: is Promise a way to convert async to synchronization?
A: not at all. Promise is just a better programming style.
Q: when do we need to write another then instead of programming in the current then?
A: when you need to call another asynchronous task.
The above is about the content of this article on "what are the Promise FAQs of JavaScript?" I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.