FIND YOUR NEXT CONCEPT
One search. Connected ideas.
Find the lesson, understand the concept, and prepare your answer.
Only JavaScript lessons and questions
2 results shown · grouped by type
Interview questions2
What is the output here?
JavaScriptOutput prediction requires following the order in which synchronous code and queued callbacks can execute. This example combines the current script, a promise microtask and a timer callback. A zero-delay timer becomes eligible later; it does not interrupt the running script.
Why does a var loop print 3 three times?
JavaScriptThe var loop creates one shared function-scoped binding for i. Every callback closes over that same binding, and the loop has already set it to 3 before the timer callbacks run. Using let in the loop header creates a separate binding for each iteration.