What is the equivalent of Ruby’s binding.pry for JavaScript console?

Sometimes, we want to use is the equivalent of Ruby’s binding.pry for JavaScript console to debug JavaScript apps.

In this article, we’ll look at what is the equivalent of Ruby’s binding.pry for JavaScript console to debug JavaScript apps.

What is the equivalent of Ruby’s binding.pry for JavaScript console?

The equivalent of Ruby’s binding.pry for JavaScript console to debug JavaScript apps is the debugger keyword.

To use it, we add debugger into our code.

And when the browser developer tools is open, the app will stop at the point where the debugger keyword is at.

For Node.js apps, we can use node debug appname.js with `debugger to achieve equivalent functionality

Conclusion

The equivalent of Ruby’s binding.pry for JavaScript console to debug JavaScript apps is the debugger keyword.