Answers for "discord function promise"

0

discord function promise

function promise(){
  return new Promise((resolve, reject) =>{
    // Code //
      resolve("Resolved!"); 	// "Returns" resolved 
      reject("Rejected!"); 		// "Returns" rejected
    // Code //
  }):
};

// Usage //
promise()
	.then(res => { 
		console.log(res)	
	}) // Done when resolved //

	.catch(err => { 
		console.log(err)	
	}) // Done when Rejected //
Posted by: Guest on August-23-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language