Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript promises MDN

new Promise((resolve, reject) => {
    console.log('Initial');

    resolve();
})
.then(() => {
    throw new Error('Something failed');

    console.log('Do this');
})
.catch(() => {
    console.error('Do that');
})
.then(() => {
    console.log('Do this, no matter what happened before');
});
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #JavaScript #promises #MDN
ADD COMMENT
Topic
Name
4+6 =