Call a function every second or 5 seconds in javascript

setinterval
function calling

call a javascript function every 5 seconds continously.  You can use setInterval(). The below code is working from onload.

setInterval(test,5000);
function test()
{
	alert("hi");
}

 

 

You might also like:

Compare the Triplets | Javascript | hackerrank.com

07-05-2020 hackerrank.com

How to search text in string using php ?

29-10-2017 php search string search

Use java script file client side and server side at a time in node js

30-07-2017 node js include call javascript

How to use http-post request in node js

14-03-2017 http-post module node js

Email validation regular expression in javascript

22-02-2017 email validation regex