Asynchawaait
Asynchawaait
What is Async/Await ?
The async keyword is used to declare an
asynchronous function.
Practical Examples
[email protected]
Here we Have
2nd Function
returning a String
3rd Function
returning a String
Output
[email protected]
Returning a
Promise
After 3
seconds
[email protected]
We’ll have a
pending promise
that’s not resolved
at runtime.
Output
[email protected]
Adding Async/Await
Now, we will use Async/Await in the Call Function to make
the code wait and get the value from the second function
Use Async on
Call function
Use Await
inside Async
function
[email protected]
Output
[email protected]
Example
[email protected]
Hope it
Helped you!
Follow for more useful Content!!