.then javascript
//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!"
});
const promise2 = doSomething().then(successCallback, failureCallback);
const myFirstPromise = new Promise((resolve, reject) => {
// esegue qualcosa di asincrono che eventualmente chiama:
//
resolve(someValue); // fulfilled
// oppure
reject("motivo del fallimento"); // rejected
});
Also in JavaScript:
- node list files in directory
- settimeout jquery
- js get all values of object
- alpine js
- angular right click on link
- double function call javascript
- semantic ui dropdown value
- js show span for 5 seconds
- in javascript how to split string
- slider plugin for angular
- add firebase javascript
- javascript sleep
- javascript even number
- ignore node_modules
- angular pipe json error
- javascript backslash
- javascript create json object from array
- javascript detectar la pagina
- remove a user from a reaction discord.js
- iframe content zoom in and zoom out jquery
- js select all
- if isset handlebars js
- find element in array underscore js
- react router not working with aws amplify