SetInterval vs setTimeout?

SetTimeout(expression, timeout) runs the code/function once after the timeout.

SetTimeout(expression, timeout); runs the code/function once after the timeout setInterval(expression, timeout); runs the code/function in intervals, with the length of the timeout between them example: var intervalID = setInterval(alert, 1000); // will alert every second // clearInterval(intervalID); // will clear the timer setTimeout(alert, 1000); // will alert once, after a second.

Thanks for the info – Pranay Rana Apr 23 '10 at 7:02.

SetInterval fires again and again in intervals, while setTimeout only fires once. References here: https://developer.mozilla. Org/en/DOM/window#Methods.

Thanks for the info – Pranay Rana Apr 23 '10 at 7:04.

SetTimeout(): It is a function that execute javascript statement AFTER x interval. SetTimeout(“do.something();”, 1000); //Execute do.something() 1 second later. SetInterval(): It is a function that execute javascript statement EVERY x interval.

SetInterval(“do.somethingElse();”, 2000); //Execute do.somethingElse() every 2 seconds. The interval unit is in millisecond for both function.

Thanks for the info – Pranay Rana Apr 23 '10 at 7:06.

SetInterval repeats the call, SetTimeout only runs it once.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions