“.then JavaScript” Code-Antworten

Versprechen Sie Fang

//create a Promise
var p1 = new Promise(function(resolve, reject) {
  resolve("Success");
});

//Execute the body of the promise which call resolve
//So it execute then, inside then there's a throw
//that get capture by catch
p1.then(function(value) {
  console.log(value); // "Success!"
  throw "oh, no!";
}).catch(function(e) {
  console.log(e); // "oh, no!"
});
POG

JS dann

doSomething()
.then(function(result) {
  return doSomethingElse(result);
})
.catch(failureCallback);
Fahim Foysal

.then JavaScript

var doSome = new Promise(function(resolve, reject){
    resolve('I am doing something');
});

doSome.then(function(value){
    console.log(value);
});
Borma

JavaScript dann () Methode

promiseObject.then(onFulfilled, onRejected);
SAMER SAEID

Ähnliche Antworten wie “.then JavaScript”

Fragen ähnlich wie “.then JavaScript”

Weitere verwandte Antworten zu “.then JavaScript” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen