This is fun, but I'm not sure it's actually very useful as a debugging tool. There are some
brilliant debugging tools for JS these days. It's quite easy to connect an IDE like VSCode to a browser using the node debugger, which gives you proper breakpoints and inspections. Alternatively, in-browser tools like Chrome devtools give you much, much more than this script too.
If you want to interactively tinker with some JS then https://repl.it/languages/javascript or https://jsbin.com/ are really good too.