Skill Zuno · skillzunos.com · Fullstack
JavaScript interview questions
Prepare for JavaScript interviews on Skill Zuno. This practice book covers JavaScript interview questions across New, Easy, Medium, Hard, and Diff levels so you can work through real interview-style problems on skillzunos.com.
Open JavaScript on Skill ZunoAlso see the JavaScript tutorial.
JavaScript is the language of the web browser and, through Node.js, of many servers. It is dynamically typed, single-threaded and event-driven, with first-class functions and prototype-based objects. JavaScript interviews dig into closures, this binding, the event loop, promises and the quirks of type coercion.
Sample JavaScript interview questions
What is a closure in JavaScript?
A closure is a function together with the variables of the scope it was created in. The inner function keeps access to those variables after the outer function returns, which is how private state, memoisation and function factories work.
What is the difference between == and ===?
=== compares value and type with no conversion. == converts the operands to a common type first, so 0 == '' and null == undefined are true. Prefer === except when deliberately checking for null or undefined together.
In what order do setTimeout and Promise callbacks run?
Promise callbacks are microtasks and run as soon as the current call stack empties, before the next macrotask. A setTimeout(fn, 0) callback is a macrotask, so a resolved promise's then() runs before it.
How do arrow functions differ from regular functions?
Arrow functions have no own this, arguments, super or new.target; they take this from the enclosing scope. They cannot be used as constructors and are best for callbacks rather than object methods.
What is the difference between let, const and var?
var is function-scoped and hoisted with the value undefined. let and const are block-scoped and sit in the temporal dead zone until declared. const prevents reassignment of the binding, but an object it holds can still be mutated.
What you can practice
- JavaScript interview questions for beginners and experienced developers
- Level-based practice: New, Easy, Medium, Hard, and Diff
- Fullstack topics alongside JavaScript on skillzunos.com