Simple ES6 Promise
by j0b02py
Babel + JSX
const delay = () => {
// Return a promise here with the signature function(resolve, reject)
// Make this promise resolve with the text "Success!" after 2 seconds
// If your implementation is correct, you should now see an alert when you run the code!
// ADD YOUR CODE HERE
return new Promise(function(resolve,reject) {
setTimeout(function() {
resolve('SUCCESS!');
//reject('error');
},2000);
});
// Hint: you will need "new Promise", "setTimeout", and "resolve"
};
delay().then((response) => {
alert(response);
});