JSFiddle - React, Tailwind, and code Playground

by colorkid

JavaScript

function debounce(fn, wait) {
	let timeOut;
  return function() {
  	return setTimeout(() => {
    	return fn.apply(this);
    }, wait)
  }
}

let foo = debounce(test, 5000);

function test() {
	console.log('hello');
}

console.log(foo());