Matej Posted April 21, 2014 Share Posted April 21, 2014 (edited) hi. Whats the diffrence between setTimeout and setInterval? I mean , when i want to make slideshow setTimeout works but Setinverval doesnt , but both of them should work for that. Edited April 21, 2014 by Matej Link to comment Share on other sites More sharing options...
Ingolme Posted April 21, 2014 Share Posted April 21, 2014 The ! operator returns a boolean value that can be true or false. !false is true, !true is false. If the data type is not boolean it will be cast to boolean. All numbers are considered true except zero. All strings are true except an empty string. If timer_is_on is 0, then !timer_is_on is true, if timer_is_on is any number other than 0 then !timer_is_on is false. Link to comment Share on other sites More sharing options...
justsomeguy Posted April 21, 2014 Share Posted April 21, 2014 Did you edit your question or something to ask something completely different? You shouldn't do that, just make a new post. Among other things, if you edit your question it doesn't let anyone know that there is a new unread post to look at.The only difference between setInterval and setTimeout is that using setTimeout will only run the code once after the certain amount of time, while setInterval will keep running the code after the interval until you stop it. Everything else works the same. Link to comment Share on other sites More sharing options...
thescientist Posted April 22, 2014 Share Posted April 22, 2014 hi. Whats the diffrence between setTimeout and setInterval? I mean , when i want to make slideshow setTimeout works but Setinverval doesnt , but both of them should work for that. the difference is well documented in the tutorials http://www.w3schools.com/jsref/met_win_setinterval.asp The setInterval() method calls a function or evaluates an expression at specified intervals (in milliseconds). The setInterval() method will continue calling the function until clearInterval() is called, or the window is closed. http://www.w3schools.com/jsref/met_win_settimeout.asp The setTimeout() method calls a function or evaluates an expression after a specified number of milliseconds. Tip: The function is only executed once. If you need to repeat execution, use the setInterval() method. Link to comment Share on other sites More sharing options...
Matej Posted April 23, 2014 Author Share Posted April 23, 2014 Oh , i wanted to update my post, seems like i accidently deleted the original one , sorry for that , and thanks for answers Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now