Microsoft interview question

How to write the debounce function in javascript