Interview Q&A / JavaScript
JavaScript interview questions
Closures, the event loop, this, promises and the core language questions every frontend round asks.
Prefer rapid revision? Practise JavaScript short interview answers →
- What is this after calling bind twice on the same function?
The first bind wins. A bound function's this is permanent, so calling bind again on it, or call and apply, cannot change it. Only extra preset arguments from the second bind take effect.
AdvancedQuick answer1 min read - Why does [] == ![] return true in JavaScript?
![] is false because an array is truthy. Then [] == false converts both sides to numbers: [] becomes "" then 0, and false becomes 0, so 0 == 0 is true.
AdvancedQuick answer1 min read