How to stop the execution of a method after sometime in JS?

How to stop the execution of a method after sometime in JS?

1 Like

You cannot stop execution of a method after some particular time though you can always “return” out of the function anytime you want to stop it’s execution. Also, there are generator functions in JS which allows to hold and continue executions according to the usecase.

Read more about generator functions here.