function throttle(someFn, delay) {
let flag = true;
return (() => {
if(flag){
someFn();
flag=false;
}
setTimeout(() => {flag=true;}, delay);
})();
};
// usage
function someFn() {
console.log('Hi')
};
throttle(someFn, 1000);