Answers for "js catch rejected promise"

1

js catch rejected promise

//makeRequest returns promise using resolve(sucess)/reject(failure)
//use .then() the first function passed in will run on sucess, 
//the second function passed in will run on failure
makeRequest('GET',"https://mywebsite.com").then(
	function(r){
		console.log("success");
	},
	function(r){
		console.log("failure");
	}
);
Posted by: Guest on May-07-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language