JS | Comments added
\nvar cancellable = function(fn, args, t) {\n\t// call first function immediately\n    fn(...args);\n    \n\t// set interval, so that function get called every 
```\nvar cancellable = function(fn, args, t) {\n\t// call first function immediately\n    fn(...args);\n    \n\t// set interval, so that function get called every t seconds\n    const interval = setInterval(() => {\n        fn(...args);\n    }, t);\n    \n    // now problems says that we have to return a function,\n\t// which when gets called, stop function call, which was\n\t// scheduled every t seconds\n\t\n    return function cancelT() {\n        clearInterval(interval);\n    };\n};\n```
[]