[6 / 2 / ?]

Javascript question

No.492696 ViewReplyOriginalReport
So, I have two buttons, if I press first one it'll start endless cycle, if I press second one - it should break it.
Sound easy, but I encountered one problem which I have no idea how to solve.
I searched internet for this and I found that the problem is in flow, and I need multi-flows to solve this, and it easily can be done in c++ or c#. But js can have only one flow, and this option is not avaible for me.

I just want to know, is there any way to break cycles from outside in js?