Engrain by ByteRush

JS.14.02 Mid-levelCore — asked often

debounce (with leading/trailing, cancel, flush)

Comes up in: Coding, UI coding

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • trailing debounce
  • preserving this and args
  • leading option
  • cancel and flush
  • maxWait
  • returning a promise variant

Words you will know

debounceleading edgetrailing edge

What you will practise

  • implement with tests (worked → faded → timed)

Interview questions this answers

  • Implement debounce. Add leading and cancel.