3 steps explanation - 3 lines of code (JS)
1) Call the function with given args immediately\n2) Call the function at regular intervals\n3) return a function that cancels the function that is executed at 
1) Call the function with given args immediately\n2) Call the function at regular intervals\n3) return a function that cancels the function that is executed at regular intervals\n\n```javascript []\nvar cancellable = function(fn, args, t) {\n    \n    // call immediately\n    fn(...args);\n\n    // call after regular intervals\n    const timerId = setInterval(()=>{fn(...args)}, t);\n\n    // return a function that cancels the function that is executed at regular intervals\n    return function() {\n        clearInterval(timerId);\n    }\n};\n\n
['JavaScript']