Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js promises

let examplePromise = new Promise(function (resolve, reject) {
  let sum;
  setTimeout(function(){
    sum = 5 + 6;
    if(sum > 10) {
      resolve(sum);
    }else{
      reject('The promise has been rejected');
    }     
  }, 2000);
});
Source by careerfoundry.com #
 
PREVIOUS NEXT
Tagged: #js #promises
ADD COMMENT
Topic
Name
9+3 =