📎 Webclip
Essential JavaScript Interview Questions
A collection of 25 JavaScript interview questions. The page focuses on language behavior, including object checks, variable scope, this, strict mode, return parsing, NaN, floating-point precision, integer tests, closures, recursion, event loop timing, logical operators, type coercion, object property keys, and DOM traversal.
Reading notes#
- The page lists questions about
typeofchecks on objects and a possible pitfall withtypeof bar === "object". - It asks about the output of code that assigns
var a = b = 3inside an IIFE. - It includes a question about
thisandselfin nested functions. - It asks why a whole JavaScript source file might be wrapped in a function block.
- It asks for the significance and benefits of
'use strict'at the top of a source file. - It compares two functions where one return statement is followed by a newline before an object literal.
- It asks what
NaNis, its type, and how to test for it reliably. - It includes a question about
0.1 + 0.2and equality with0.3. - It asks for possible ways to write
isInteger(x). - It asks about console logging order with
setTimeoutdelays of1000and0. - It asks for a short palindrome function.
- It asks for a
summethod that works as bothsum(2,3)andsum(2)(3). - It asks about a loop creating buttons with click handlers that reference
i. - It asks about array mutation after
reverse()andpush(). - It asks about string and number coercion in several
console.logexpressions. - It asks how to avoid stack overflow in a recursive list processor while keeping the recursive pattern.
- It asks what a closure is and requests an example.
- It asks about delayed logging in a loop and how closures can help.
- It asks how
||and&&evaluate and what values they return. - It asks about
false == '0'andfalse === '0'. - It asks what happens when objects are used as property keys.
- It includes a recursive factorial-style function call.
- It includes a nested immediately invoked function expression that logs a captured variable.
- It asks about losing
thiswhen a method is assigned to another variable. - It asks for a function that visits a DOM element and all of its descendants and passes each to a callback.
