DEV Community

Cover image for How to write a promise in javascript
Augustus Otu
Augustus Otu

Posted on • Updated on

How to write a promise in javascript

Hello and welcome to my post. I am going to teach you how to write a promise. First, why should you use promises in your code? The answer is simple, and that is, it helps you wait for the response of an action before going on to perform another action. I know you want to see the code so here you go.

Alt text of image

It is as simple as you see. Now you can go ahead and have promises in your code.
You can connect with me on twitter. Thank you and happy coding

Top comments (0)