Timeout Cancellation 
ExplanationUnderstand Requirements:A function cancellable takes three parameters:
fn: A function to be executed after the delay.
args: An array of arguments to
# Explanation
# Understand Requirements:
A function cancellable takes three parameters:
fn: A function to be executed after the delay.
args: An array of arguments to be passed to fn when it is executed.
t: Delay time in milliseconds before fn is executed.

The cancellable function should return a cancelFn:
If cancelFn is called before the t delay expires, the execution of fn is cancelled.
If cancelFn is not called, fn executes after the delay with args passed to it.

# Key JavaScript Concepts:
setTimeout: Schedule the execution of fn after t milliseconds.
clearTimeout: Cancel the timeout if cancelFn is invoked before the timeout expires.
Tracking Time: Use Date.now() or other methods to log when the execution or cancellation happens.

# Steps:
Use setTimeout to schedule the execution of fn.
Store the timeoutId returned by setTimeout.
Define and return the cancelFn that calls clearTimeout with the stored timeoutId.

# Implementation:
Wrap the logic in a function cancellable that adheres to the problem's requirements.
Ensure cancelFn cancels the fn execution cleanly and efficiently.

# Edge Cases:
Cancellation happens exactly at the timeout (t ms).
The fn execution is delayed but not cancelled.

# Complexity Analysis
# Time Complexity:
setTimeout and clearTimeout are O(1), as scheduling and cancelling timeouts have constant complexity.
Overall: O(1).

# Space Complexity:
Storage for timeoutId and minimal memory for scheduling the timeout.
Overall: O(1).
# Code
```javascript []

function cancellable(fn, args, t) {
    let timeoutId;

    // Schedule the execution of fn after t milliseconds
    timeoutId = setTimeout(() => {
        fn(...args);
    }, t);

    // Return the cancel function
    return () => {
        clearTimeout(timeoutId); // Cancels the scheduled execution
    };
}

```
['JavaScript']