As an example
var runInfinite = function(){
while(1)
{
// Do stuff;
}
};
setTimeout(runInfinite, 0);
Is it possible to break this runInfinite function form running infinite? I mean is it possible to kill this function from another function without using a flag or return statement?
The answer is no. Since JavaScript is single-threaded ( unless you are using some less common implementation which I doubt ) nothing can break a loop ( or any other block of code ) from outside.