JavaScript bank Functions JavaScript / 29 questions Your progress 0 / 29 done Saved in this browser. Reset All 29 Easy 9 Medium 15 Hard 5 Hide done No questions match those filters. 01 Explain the difference between function declarations, function expressions, and arrow functions. Easy 02 Why can't arrow functions be used as constructors or have their own `this`? Medium 03 Explain default parameters and how they interact with the `arguments` object. Easy 04 What are higher-order functions? Give three real examples from the standard library. Easy 05 Implement a generic `curry(fn)` function supporting variable arity. Hard 06 Implement `compose` and `pipe` utility functions for function composition. Medium 07 What is a pure function? Why do pure functions matter for testability and memoization? Easy 08 Explain rest parameters vs the legacy `arguments` object. Easy 09 Implement a `once(fn)` utility that ensures a function only runs a single time. Easy 10 Explain function hoisting differences between function declarations and function expressions. Medium 11 Implement a generic `memoize(fn)` function, including handling of multiple arguments. Hard 12 What is a closure? Explain with a minimal example and describe the underlying scope-chain mechanism. Easy 13 Classic loop + `setTimeout` + `var` bug: explain why all callbacks log the same value, and fix it three different ways. Medium 14 Implement a private counter using closures (module pattern) with `increment`, `decrement`, and `getValue`. Easy 15 Explain how closures can cause memory leaks if not managed carefully (e.g., retained DOM references). Hard 16 Implement a `debounce(fn, delay)` function using closures. Medium 17 Implement a `throttle(fn, limit)` function using closures. Medium 18 Explain the difference between closures capturing variables by reference vs by value. Medium 19 Implement a simple memoization cache using a closure over a `Map`. Medium 20 How would you use closures to implement data privacy before ES2022 private class fields existed? Medium 21 Write a function `makeAdder(x)` that returns a function adding `x` to its argument — explain what's captured in the closure. Easy 22 Explain the four/five rules for determining `this`: default, implicit, explicit, new, and arrow-function inheritance. Medium 23 Why does `this` become `undefined`/global inside a regular callback passed to `setTimeout` or an event handler? Medium 24 Implement your own version of `Function.prototype.bind`. Hard 25 Implement your own version of `Function.prototype.call` and `Function.prototype.apply`. Hard 26 Explain how arrow functions resolve `this` lexically and why that makes them unsuitable as object methods. Medium 27 Explain how `this` behaves inside a class method vs a class field arrow function. Medium 28 What does `this` refer to inside a DOM event handler attached via `addEventListener` vs an inline `onclick`? Medium 29 Explain `new` binding — what four things happen when you call a function with `new`? Medium ← Previous Data Structures Next → Engine Internals