Javascript has setInterval and clearInterval functions for handling asynchronous function calls.
Is there a difference between clearInterval(handle) and window.clearInterval(handle)?
I’ve seen it being used both ways.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In a browser, all global functions are implicitly properties of the
windowobject. SoclearInterval()andwindow.clearInterval()are the exact same thing.There is no difference between them unless you define a local function called
clearInterval(), in which casewindow.clearInterval()would reference the global one andclearInterval()would reference the local one.The same would be true for any global functions that you define yourself.