Home  >  Article  >  Web Front-end  >  js code executes an instance of a function after delaying a certain period of time

js code executes an instance of a function after delaying a certain period of time

不言
不言Original
2018-05-05 16:19:581993browse

This article mainly introduces examples of js code executing a function after a certain delay. It has certain reference value. Now I share it with you. Friends in need can refer to it

The example is as follows:

 setTimeout(funcName,500);
		
    function funcName() {
      xxxxxx;
    }

Execute funcName() after 0.5 seconds and only execute it once

setInterval(funcName ,5000); Execute funcName() every 5 seconds

Related recommendations:

JS implements dynamically adding events to the label control

The above is the detailed content of js code executes an instance of a function after delaying a certain period of time. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn