0

Hey I'm new to javascript promises. I am getting several errors stating a promise is created but not returned. How do you return from a promise?

  • A minimum of example code and error messages are needed in the order to receive any help – Mikko Ohtamaa Jan 23 '17 at 10:45
2

It is a purely Javascript thing, the interpreter does not like it when you create a Promise in a scope, and do not return it out of it.

function standardOne() {
    return new Promise(function (resolve, reject) {
  //^^ See this return? That's what you need to do.
        // do something
    });
}
  • Ok thanks, I need to do some studying on promises and callbacks – ethereal Jan 23 '17 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.