Skip to content

Instantly share code, notes, and snippets.

@lumosmind
Last active November 7, 2020 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lumosmind/17245d190c5b6dc27f43b826a5418b3e to your computer and use it in GitHub Desktop.
Save lumosmind/17245d190c5b6dc27f43b826a5418b3e to your computer and use it in GitHub Desktop.
let id = 21;
function executor (resolve, reject){
getData(id, resolve)
};
const myPromise = new Promise(executor);
myPromise
.then((result)=>{
//adım 1
console.log(result);
id = 22;
return new Promise(executor);
})
.then((result)=>{
//adım 2
console.log(result);
id = 23;
return new Promise(executor);
})
.then((result)=>{
//adım 3
console.log(result);
id = 24;
return new Promise(executor);
})
.then((result)=>{
//adım 4
console.log(result);
id = 25;
return new Promise(executor);
})
.then((result)=>{
//adım 5
console.log(result);
id = 26;
return new Promise(executor);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment