0 points

Promises


dashboard

Wed Oct 14 2020 08:43:45 GMT+0000 (UTC)

Posted 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_copy Copy