Skip to content

Instantly share code, notes, and snippets.

@mertcanaltin
Created July 3, 2021 19:35
Show Gist options
  • Save mertcanaltin/4b1db1ce9c002cf845719d1a05428e1d to your computer and use it in GitHub Desktop.
Save mertcanaltin/4b1db1ce9c002cf845719d1a05428e1d to your computer and use it in GitHub Desktop.
const getComments = (number) => {
return new Promise((resolve,reject) => { // resolve:işlem başarılı buyur datan , reject:bir problem oluştu ben bunu reddettim
if(number === 1){
resolve({text:'selam'}); //number da döner obje de
}
reject('bir problem oldu');
})
}
getComments(1) //getComments parametresi 1.satır
.then((data) => console.log(data))
.catch(e => console.log(e));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment