Simple solution with walk through  🤝👍
Approach\n Describe your approach to solving the problem. \n1. The cancellable function takes three parameters: fn, args, and t.\n\n2. fn is the function to be 
# Approach\n<!-- Describe your approach to solving the problem. -->\n1. The cancellable function takes three parameters: `fn`, `args`, and `t`.\n\n2. `fn` is the function to be executed after a delay.\n`args` is an array of arguments to be passed to the function `fn`.\n`t` is the delay in milliseconds.\nInside the `cancellable` function, a variable `cancel` is initialized to false. This variable will be used to determine if the execution of the delayed function should be canceled.\n\n3. The `setTimeout` function is called with an arrow function as the callback. This arrow function checks the value of `cancel` and executes the function fn with the provided arguments `...args` only if `cancel` is false. The timeout value is set to `t` milliseconds.\n\n4. The `setTimeout` function schedules the execution of the arrow function after the specified delay.\n\n5. Finally, the `cancellable` function returns another function. This returned function is used to cancel the execution of the delayed function.\n    When the returned function is invoked, it sets `cancel` to true, effectively canceling the execution of `fn` if it hasn\'t occurred yet.\n\n# Complexity\n- Time complexity:\nO(max(t,cancelT))\n\n# Code\n```\nvar cancellable = function(fn, args, t) {\n    let cancel = false;\n    setTimeout(() =>!cancel && fn(...args),t)\n    return () => cancel = true\n};\n```
['JavaScript']