function debounce (func, wait) {
let timeout;
return function () {
let context = this;
let args = arguments;
if(timeout) clearTimeout(timeout);
timeout = setTimeout(function(){
func.apply(context, args);
}, wait);
}
}
`