I am trying to pause computation in javascript and interact with variables defined prior to the interrupt line.
In python, you can do this by inserting a call to interact from the code package:
import code
cat = 'cat'
pi = 3.14
def foo(bar):
a = 3
b = 'hello'
code.interact(local=dict(globals(), **locals()))
return bar
Making a call to foo
in the above code would pause computation on the line with the call to interact, and you would be able to interact with the local variables a
and b
as well as the function arguments bar
and any variables/functions within the scope of the interact (such as globally defined cat
and pi
variables).
I use code.interact for all my debugging in python. It's simple and lightweight. It would be great to be able to have something like code.interact in javascript, but I haven't found anything yet.
Is there something like python's code.interact
function in javascript