Promises

PHOTO EMBED

Wed Oct 14 2020 08:43:45 GMT+0000 (Coordinated Universal Time)

Saved by @snigdhakhurana10

let promise = new Promise(function(resolve, reject){
  const string1 = 'Snigdha';
  const string2 = 'Snigdha';
  if(string1 === string2)
      resolve();
  else 
      reject();
});

promise.then(function(){
  console.log('Hey Snigdha!')
})
.catch(function(){
  console.log('Oops!')
})
content_copyCOPY