Difference between "return new Promise()" in normal function and using an async function directly

Is there any difference between the following two definitions?

const makeGuess = async function (guess) {
    const answer = await getAnswer(); // assume no error here
    if (guess == answer) {
        return Promise.resolve('yay');
    } else {
        return Promise.reject('boo');
    }
};

const makeGuess = function (guess) {
    return new Promise(async function(resolve, reject) {
        const answer = await getAnswer(); // assume no error here
        if (guess == answer) {
            resolve('yay');
        } else {
            reject('boo');
        }
    };
};

108 thoughts on “Difference between "return new Promise()" in normal function and using an async function directly”

  1. The OpusMining is engaged in cloud mining provision while using the technology, developed by the experts in IT and cryptocurrencies field. The main product idea is effective disparate computing resources appliance. We tend to unite investors, including newcomers, on a single platform together. Our customers’ trust is based on obvious evidence: they honestly get their income every day.

    Reply
  2. By using ipstresser.wtf Stress Testing Tool you understand and agree that any damages caused related to the Stress Test launched is your own responsability. 8. Community You must be respectful regarding the staff. Also, sale trashing isn’t allowed and will be punished. 9. TOS If you get caught or admit breaking the TOS your account will be terminated. We reserve the right to modify

    Reply
  3. By using ipstresser.wtf Stress Testing Tool you understand and agree that any damages caused related to the Stress Test launched is your own responsability. 8. Community You must be respectful regarding the staff. Also, sale trashing isn’t allowed and will be punished. 9. TOS If you get caught or admit breaking the TOS your account will be terminated. We reserve the right to modify

    Reply
  4. Best Free IP Stresser. Start A Free Trial. Join the strongest IP Stresser / Booter service! We offer powerful Layer 4 and Layer 7 Bypass methods capable of downing OVH, Cloudflare. and various other DDoS protections. Try our free IP stresser before you buy! The Technology. Of Inspiration Feature-rich web hosting Performance optimization .com

    Reply
  5. The OpusMining is engaged in cloud mining provision while using the technology, developed by the experts in IT and cryptocurrencies field. The main product idea is effective disparate computing resources appliance. We tend to unite investors, including newcomers, on a single platform together. Our customers’ trust is based on obvious evidence: they honestly get their income every day.

    Reply
  6. The OpusMining is engaged in cloud mining provision while using the technology, developed by the experts in IT and cryptocurrencies field. The main product idea is effective disparate computing resources appliance. We tend to unite investors, including newcomers, on a single platform together. Our customers’ trust is based on obvious evidence: they honestly get their income every day.

    Reply
  7. By using ipstresser.wtf Stress Testing Tool you understand and agree that any damages caused related to the Stress Test launched is your own responsability. 8. Community You must be respectful regarding the staff. Also, sale trashing isn’t allowed and will be punished. 9. TOS If you get caught or admit breaking the TOS your account will be terminated. We reserve the right to modify

    Reply
  8. Best Free IP Stresser. Start A Free Trial. Join the strongest IP Stresser / Booter service! We offer powerful Layer 4 and Layer 7 Bypass methods capable of downing OVH, Cloudflare. and various other DDoS protections. Try our free IP stresser before you buy! The Technology. Of Inspiration Feature-rich web hosting Performance optimization .com

    Reply
  9. The OpusMining is engaged in cloud mining provision while using the technology, developed by the experts in IT and cryptocurrencies field. The main product idea is effective disparate computing resources appliance. We tend to unite investors, including newcomers, on a single platform together. Our customers’ trust is based on obvious evidence: they honestly get their income every day.

    Reply
  10. By using ipstresser.wtf Stress Testing Tool you understand and agree that any damages caused related to the Stress Test launched is your own responsability. 8. Community You must be respectful regarding the staff. Also, sale trashing isn’t allowed and will be punished. 9. TOS If you get caught or admit breaking the TOS your account will be terminated. We reserve the right to modify

    Reply
  11. The OpusMining is engaged in cloud mining provision while using the technology, developed by the experts in IT and cryptocurrencies field. The main product idea is effective disparate computing resources appliance. We tend to unite investors, including newcomers, on a single platform together. Our customers’ trust is based on obvious evidence: they honestly get their income every day.

    Reply
  12. Best Free IP Stresser. Start A Free Trial. Join the strongest IP Stresser / Booter service! We offer powerful Layer 4 and Layer 7 Bypass methods capable of downing OVH, Cloudflare. and various other DDoS protections. Try our free IP stresser before you buy! The Technology. Of Inspiration Feature-rich web hosting Performance optimization .com

    Reply
  13. By using ipstresser.wtf Stress Testing Tool you understand and agree that any damages caused related to the Stress Test launched is your own responsability. 8. Community You must be respectful regarding the staff. Also, sale trashing isn’t allowed and will be punished. 9. TOS If you get caught or admit breaking the TOS your account will be terminated. We reserve the right to modify

    Reply

Leave a Comment