Categories
JavaScript Answers

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

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *