javaScript中的重要承诺。。。。。。
Important of Promises in javaScript......
Defination - Promises are used to handle asynchronous operations. The promise object represent the eventual completion or failure.
Benefit of Promises- 1.Improves code reusability. 2.Better error handling.
Example -
Output -
States of promises - 1.Pending = Initial State. 2.Fulfilled = Operation completed. 3.Rejected = Operation Failed