Implement debounce decorator

Debounce decorator is a high-order function that delays the function execution by the given timer. You are required to implement it.

Debouncing is particularly useful when you want to avoid the function being fired too frequently. A common use case is in search bars where you might want to wait for the user to finish typing before making an API call to fetch search results.

const debounce = (fn, ms) => {
  // ... your implementation
};

Example

const print = (n) => {
  console.log(n);
};

const fn = debounce(print, 1000);
fn(1); // ignore
fn(2); // ignore
fn(3); // prints 3