JSFiddle - React, Tailwind, and code Playground

by colorkid

JavaScript

function debounce(fn, wait) {
   return function() {
  	setTimeout(() => {
    	fn.apply(this, [...arguments]);
    }, wait)
  }
}

let foo = debounce(test, 1000);

function test(word, word2, word3) {
	console.log('hello');
  console.log(word);
  console.log(word2);
  console.log(word3);
}

foo('hiphop', 'rock', 'house');