0

I would like to know which is the best solution when using asynchronous programming. Which one should I use?

3
  • Avoid any tutorials that still advocate yield for asynchronous programming with promises, they are totally outdated. Commented Dec 9, 2018 at 15:59
  • Like the name suggests, async/await are specifically designed for asynchronous programming. Yield is meant to be used in generator functions. Yield is still useful on this date, but not for asynchronous programming. Commented Dec 10, 2018 at 10:33
  • yield is tied to Generators which can be combined to Promises to handle asynchronous iterations … This pattern is now considered obsolete so to speak since async/await construct is now supported by JavaScript runtimes. Quote from Mozilla developper network : «…Just as Promises are similar to structured callbacks, async/await is similar to combining generators and promises.» Commented Dec 10, 2018 at 11:02

1 Answer 1

2

Always use async/await for asynchronous tasks.

Yield should only be used for generator functions. Read this article on when and how to use (it's worth the time).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.