For example, the variable x is an object of the function my. I only want the function my to run for a period of time but I don't know how to stop it.
function my (num){
while (1) // means this process is an infinite loop
{
console.log(1);
}
}
var x = new my();
In the premise of not modifying the function my(because the origin function is very complex), how to stop the function, or how to delete the object?
while(1)without an exit, you probably cannot do anything without changing that while loop.