✅Easy short solution
\n\nvar cancellable = function(fn, args, t) {\n var cancellable = function(fn, args, t) {\n    fn(...args);\n    const timer = setInterval(() => fn(...args), t)
\n```\nvar cancellable = function(fn, args, t) {\n var cancellable = function(fn, args, t) {\n    fn(...args);\n    const timer = setInterval(() => fn(...args), t);\n\n    const cancelFn = () => clearInterval(timer);\n    return cancelFn;\n};\n\n```\nThankyou:)
[]