setInterval("FunctionA()", 1000);
Now how do I clear this interval after exactly 5 seconds so that I can achieve -
var i = setInterval("FunctionA()", 1000);
(After 5 seconds)
clearInterval(i);
You can do this using setTimeout
function:
var i = setInterval(FunctionA ,1000);
setTimeout(function( ) { clearInterval( i ); }, 5000);