問題文
A legacy helper takes an error first callback. A team wants to await it. What is the appropriate step?
選択肢
- Call the helper inside a loop and read the returned value once the loop finishes.
- Mark the helper as async, and adding the keyword makes the engine convert the callback style into a promise automatically.
- Wrap the helper in a function that returns a new promise and resolves or rejects it from inside the callback.
- Await the helper directly, and await accepts any value and will wait for a callback based function.