I’m wondering if there’s a way to make setInterval clear itself.
Something like this:
setInterval(function () {
alert(1);
clearInterval(this);
}, 2000);
I want it to keep checking thing if it’s finished it will stop.
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.
Try this way:
Alternative way is using
setTimeout()if you know it is just one time call.