Home / javascript / Simple JavaScript code in promises.

Simple JavaScript code in promises.

function promiseExample(){
    const promise = new Promise((resolve, reject) =>{
    .then((resolve) => console.log(resolve))
    .catch((reject) => console.log(reject));
  return promise;

I have a create simple code example for promises. you can easily check. how to resolve is working? and how to reject is working?

About admin

Check Also

What are the differences between var, let and const in JavaScript?

var, let, and const are all used for variable declaration in JavaScript, but they have …

Leave a Reply

Your email address will not be published. Required fields are marked *