Parameters: The promise constructor contains a single parameter:
- executor: The executor can be the custom code that ties an outcome to a promise. You, the programmer, write the executor.
Return Value: Another promise object, in which case the promise gets dynamically inserted into the chain.
Example 1: Creating only one promise constructor.
[object Promise] "geeks for geeks"
Example 2: In this code, we are going to create two promise constructors.
[object Promise] "geks for geeks" "computer sciemce portal"
Example 3: In this example, we will display a value.
5 "geeks for geeks" "computer science portal"
My Personal Notes arrow_drop_up
Please Login to comment...