Simple ES6 Promise

by Pritesh Patel

JavaScript

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!
  
  return new Promise((resolve, reject) => {
  	setTimeout(function(){
    	resolve("Success!");
  	}, 2000);
  })
  // Hint: you will need "new Promise", "setTimeout", and "resolve"
};

delay().then((response) => {
	alert(response);
});