Recruitment and knowledge question base. Filter, search and test your knowledge.
var is function-scoped and can be re-declared; let/const are block-scoped. const prevents reassignment (but objects can still be mutated).
Function and var declarations are hoisted, but initializations are not. let/const are hoisted too but live in the temporal dead zone until initialized.
== does type coercion before comparison, while === compares both value and type without coercion.
A closure is when an inner function retains access to variables from an outer scope. It is commonly used for data privacy or function factories.
this is determined by the call site. call/apply invoke the function immediately with an explicit this, while bind returns a new function with this permanently set.
Objects inherit from other objects via the prototype chain. Property lookups walk up the chain until found or null. You can create links with Object.create or class syntax.
The event loop processes the call stack and task queues. Microtasks (e.g., Promise callbacks) run before the next macrotask (e.g., setTimeout).
A Promise represents a future value (pending/fulfilled/rejected) and supports chaining with then/catch. Callbacks are functions passed to be invoked later, often leading to nested code.
async/await is syntax over Promises that lets you write async code in a sync style. Use try/catch around await or handle rejections with .catch().
Shallow copy duplicates only top-level properties and keeps nested references. Deep copy recursively clones nested objects (e.g., structuredClone or a custom deep clone).
Debounce delays execution until events stop firing; throttle limits execution to at most once per interval. Use debounce for input typing, throttle for scroll/resize.
undefined means a variable was declared but not assigned; null is an explicit empty value. typeof null is a historical "object".
Type coercion is automatic conversion between types (e.g., 3 + 2 + "7" becomes "57").
map transforms each element, filter keeps elements that match a predicate, and reduce accumulates values into a single result.
Promise.all waits for all promises to resolve and rejects if any reject. Use it to run independent async tasks in parallel and wait for all results.