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!')
})
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter