Middle
If you declare an async function and call it without await, what will it return?
sobes.tech AI
Answer from AI
If you call an async function without await, it will immediately return a Promise object. This Promise will be in the "pending" state until the function completes, after which it will transition to the "fulfilled" state with the result or "rejected" with an error.
Example:
async function foo() {
return 42;
}
const result = foo();
console.log(result); // Promise {<fulfilled>: 42}
That is, without await, you get the Promise itself, not the value that the async function returns.