Is there any way to stop a running Javascript function from outside of this function?
Share
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.
No. There is no “outside” of a function in JS. Once the running script is “outside” the function the function is completed running.
UPDATE
If there is some condition that could become true while a particular function is running that you would like to cause that function to exit, then you can check for that condition inside the function at regular intervals and exit the function if it is true.