Implement throttle Decorator
Throttling is a technique that ensures that the function does not execute more than once in a specified time period.
This is useful for managing the performance of functions that could be triggered frequently.
You are required to implement throttle(fn, delay) decorator function.
Example
function throttle(fn, delay) {
// Your implementation
}
const print = () => {
console.log("print");
};
const fn = throttle(print, 1000);
// fn function will be called once in a second on window resize
window.addEventListener("resize", fn);