Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

object promise javascript

let promise = new Promise(function(resolve, reject){
  try{
  	resolve("works"); //if works
  } catch(err){
    reject(err); //doesn't work
  }
}).then(alert, console.log); // if doesn't work, then console.log it, if it does, then alert "works"
Source by stickynotepickles.herokuapp.com #
 
PREVIOUS NEXT
Tagged: #object #promise #javascript
ADD COMMENT
Topic
Name
9+4 =