title: How to limit the execution time of a function in javascript?
body: <p>The situation is:</p>
  
  <p>User writes some js-code and it should be runned on some data (locally).</p>
  
  <p>But sometimes there are endless loops or recursive calls… That's why I need to limit the execution time of a function but not to edit the function itself (and even if so — should I insert checks after every sequence point? but what about recursive calls?)</p>
  
  <p>Are there any other solutions for this strange problem? Maybe eval can give some parse tree of the code or something like that?</p>