Ant Group interview question

Coding Question 2 I had to explain the difference between throttle and debounce, and implement both from scratch. The throttle function should ensure the passed function runs at most once every n seconds. The debounce function should delay the execution of the passed function until n seconds have passed since the last invocation.