thecodingcompany
Programming

JavaScript coding practice

Frontend, full-stack and increasingly AI product roles.

Exercises6
FormatPrompt + hint

6 exercises

Try each one before reading the hint. If you finish without using the hint, move on; if the hint is not enough, work the neighbouring DSA pattern.

01Debounce a function
TaskImplement debounce(fn, delay) which delays invoking fn until delay ms have elapsed since the last call.
HintKeep a timer reference in a closure and clearTimeout on each new call.
02Deep clone an object
TaskWrite a deepClone that handles nested objects and arrays but not functions.
HintRecurse, creating a new array or object when the value is an object; return primitives as-is.
03Flatten a nested array
TaskFlatten an arbitrarily nested array to depth 1, without using Array.prototype.flat().
HintReduce with Array.isArray checks, or use an explicit stack.
04Group array of objects by key
TaskGiven [{k, v}], group the objects into an object keyed by k.
HintReduce into an accumulator, creating the array for a key on first sight.
05Curry a function
TaskImplement a curry helper that turns f(a, b, c) into f(a)(b)(c).
HintUse fn.length to know the expected arity and return a collector until enough arguments arrive.
06Promise.all polyfill
TaskImplement a function behaving like Promise.all without using Promise.all.
HintReturn a new Promise that resolves once a counter reaches the input length, storing results by index.

Practise here. Get placed there.

Prep+ is unlimited practice. When you are ready to turn it into an offer, TCC Placement Partner handles portfolio, resume and interviews.