Junior — Senior
Creating a delayed function call method
livecode
Task condition
The task provides a function someFn. It is required to add a .delay(ms) method to it, which will return a new function. When this new function is called, the original function should execute after the specified delay.
function someFn(...args) {
console.log(...args);
}
someFn.delay(2000)('Hello', 'World');
// After 2 seconds, it will output: Hello World