Yet another reason to ❤️ async/await: If you mark a JavaScript function as...


Yet another reason to ❤️ async/await:

If you mark a JavaScript function as async, anything it returns is automatically wrapped in a promise.

This makes it trivial to create mock APIs:
1. Declare an async function
2. Return data

The caller will receive a promise.

#javascript

View original on X