Full Stack / 3 min read
Part 3: I Asked 25 Developers This Async JavaScript Question — Only 3 Got It Right
“It worked on my local” isn’t an async strategy. It’s a bug in disguise.
Part 3: I Asked 25 Developers This Async JavaScript Question — Only 3 Got It Right
“It worked on my local” isn’t an async strategy. It’s a bug in disguise.

Let’s do a Role Play😄
You’re in a frontend interview.
The interviewer shares this code snippet in chat:
async function fetchData() {
return await Promise.resolve('Data loaded');
}function getData() {
const data = fetchData();
console.log(data);
}
getData();Quick Question — what will it log?
No debugger. No search. Just your brain.

What Most People Say
“It should log 'Data loaded' right?” I know you’re guessing it must not be ‘Data loaded’ otherwise why this blog?and You’re right. ‘Data Loaded’ is not the answer here.
And that’s the problem with how most devs “learn” async/await.
They understand the syntax, not the behavior. I was one of them at some point of time.
The Actual Output
Promise { <fulfilled>: 'Data loaded' }Why?
Because fetchData() is async. That means it always returns a promise, even if the value is already resolved.
So when you call console.log(data), you're logging a promise, not the value it resolves to.
Fix It
To actually see 'Data loaded' in the console:
async function getData() {
const data = await fetchData();
console.log(data);
}Or, if you’re outside an async function:
fetchData().then(console.log);Real-Life Pain Point
This is why APIs in production sometimes “randomly fail.”
Someone wrote:
const result = getAPIData();
if (result.success) {
// do something
}But getAPIData was async—and the check ran on a pending promise.
Your app? 🧨 Broken in silence. Your Production crashed loudly 💥

Want Another Round? Try This
What does this log?
console.log('Start');
setTimeout(() => {
console.log('Timeout');
}, 0);
Promise.resolve().then(() => {
console.log('Promise');
});
console.log('End');Think of it, I know you can.
Let’s test your expertise. Answer this in the comments and let’s see who gets it right ?— without running it(No cheating😂).
Quick Takeaways
asyncalways returns a promise.awaitworks only inside anasyncfunction.setTimeoutdelays go in the task queue.- Promises use the microtask queue and are prioritised.
Coming Up Next in Series
Next Reads:
Part 4: A Basic Async Question That Left Almost Every Interviewee Confused (Don’t Make the Same Mistake)
Part 5: The JavaScript Event Loop Trap That Broke My Mental Model
Your Turn
What async JS trick confused you the most?
Drop it in the comments, and I might include it in Part 4.
At Dev Simplified, We Value Your Feedback 📊
👉 Follow us to not miss any updates.
👉 Have any suggestions? Let us know in the comments!