Interview Q&A / JavaScript

INTERVIEW Q&A · 71 QUESTIONS

JavaScript interview questions

Closures, the event loop, this, promises and the core language questions every frontend round asks.

  1. 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