ES6+medium
JavaScript fundamentals checklist for frontend interviews
Walk through the JavaScript fundamentals a frontend engineer should know: scope, closures, hoisting, equality, `this`, prototypes, async behavior, modules, and common runtime pitfalls.
Asked at Tenable
Answer
Interview framing: This is usually a breadth question. Give a structured checklist and show that you can connect language rules to real bugs.
Core topics:
- Scope and closures:
- let/const are block-scoped; var is function-scoped.
- A closure lets a function remember variables from its outer scope.
- Common use cases: event handlers, memoization, debounce, private state.
- Hoisting and TDZ:
- Function declarations are callable before their declaration.
- var is hoisted and initialized to undefined.
- let/const are hoisted but unavailable until initialized (temporal dead zone).
- Equality and coercion:
- Prefer === because it avoids implicit coercion.
- Know common surprises: [] == false, '0' == 0, null == undefined.
- this binding:
- Determined by call site: default, implicit, explicit call/apply/bind, or new.
- Arrow functions do not have their own this; they capture lexical this.
- Prototypes and classes:
- Classes are syntax over prototype-based inheritance.
- Property lookup walks the prototype chain.
- Async model:
- Synchronous code runs first.
- Promise callbacks run as microtasks.
- Timers, events, and network callbacks are macrotasks.
- Common frontend pitfalls:
- Mutating shared objects accidentally.
- Missing return in promise chains.
- Forgetting cleanup for timers/listeners.
- Relying on stale closure values in callbacks.
Strong closing sentence: "I try to explain JS fundamentals by tying them to production bugs: stale state, wrong this, race conditions, memory leaks, and unexpected async ordering."
Source: Tenable frontend prep