I experienced that the Pry introspection gem https://github.com/pry/pry for Ruby makes the program develompent easier a lot: one can stop the program at a given point with the statement "binding.pry", it gives a console, where I can introspect the values of the variables, which are existing that point. Would be so helpfil such a tool for JavaScript too, in the browser. To debug the programs, as it is so easy to make mistakes, which are then barely recognizable.
If you've been developing without such a tool thus far I commend you-- that sounds painful. In chrome, F12
or Menu > More Tools > Developer Tools
will open the Chrome Dev Tools. There is a fully featured debugger in which you can set breakpoints, or you can simply put a debugger
statement directly in your code to have it pause. These tools are robust, mature, and built into every modern browser (although note that different browsers will have different ways in which to access them). The Console tool acts as more of a REPL, if that's what you desire; plus, it gets the environment of the current scope in which the debugger is paused, so you can use it to inspect variables, etc. Good luck!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.