No, it is not necessary to employ async in a function that only gives back the output of Promise.resolve(). You can simply use Promise.resolve() to return a resolved promise with the specified value. However, if the function involves some asynchronous operations, using async/await is recommended to ensure the code is executed in the expected order.
Asked: 2023-06-16 14:09:42 +0000
Seen: 12 times
Last updated: Jun 16 '23