Skip to content

Instantly share code, notes, and snippets.

@sagarkbhatt
Last active April 26, 2017 09:49
Show Gist options
  • Save sagarkbhatt/4c309c702d0aea94a13dd7a202cf5278 to your computer and use it in GitHub Desktop.
Save sagarkbhatt/4c309c702d0aea94a13dd7a202cf5278 to your computer and use it in GitHub Desktop.
const promise = new Promise ( ( resolve, reject ) => {
setTimeout( ()=>{
resolve( 'success' );
}, 300);
setTimeout( () =>{
reject( 'error' );
}, 25);
} );
promise.then( (res)=>{
console.log( res );
})
.catch( (res) => {
console.log( res );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment