Answers for "sending value to promise"

0

sending value to promise

var some_function = function(username, password)
{
 return new Promise(function(resolve, reject)
 {
  /*stuff using username, password*/
  if ( /* everything turned out fine */ )
  {
   resolve("Stuff worked!");
  }
  else
  {
   reject(Error("It broke"));
  }
 });
}
Posted by: Guest on March-18-2021

Browse Popular Code Answers by Language