Carousell interview question

Implement debounce function using JS.

Interview Answer

Anonymous

Jun 16, 2021

function debounce(func, wait) { let timeout return function(...args) { const context = this clearTimeout(timeout) timeout = setTimeout(() => func.apply(context, args), wait) } }