JSFiddle - React, Tailwind, and code Playground

by TheDiamondDoge

JavaScript

const funcWithDelay = (f, delay) => {
    let timeout;
    return function () {
    console.log("yes, it IS");
        if (timeout) clearTimeout(timeout);
        timeout = setTimeout(() => (
            f.apply(...arguments)
        ), delay);
    }
};

function x() {
	console.log("Is it truly a wrapper?");
} 

let y = funcWithDelay(x, 1000);
y();