Home >Web Front-end >JS Tutorial >Delayed execution function of Javascript Function object extension_javascript skills
Why not just use the setTimeout method of the window object? Bingo, that's right! If you often need to "delay the execution of a certain function" in an application, then based on the DRY principle, you can extend the Function global object and add a delay method such as delay to the function. This will allow Your code is more concise and efficient.
The delay method added to the function object of the expanded site is as follows: