Skip to content

6 - Debounce - javascript #345

Open
Open
@DevSecArj

Description

@DevSecArj

index.js

export function debounce(func, delay) {
  // write your code here
  let timer;

  return function(...args) {
    if(timer) clearTimeout(timer)
    timer = setTimeout(() => {
      func.apply(this, args)
    }, delay)
  }
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions