Initially, when one learns JavaScript, they usually start out with console.log statements to know values of variables.
Similar to what Xdebug provides for PHP, most browsers come built-in with developer tools that allow you to debug JavaScript code. In the following session, we’ll cover how to use breakpoints and step debugging with Chrome’s built-in developer tools. The process is similar in most web browsers (Chrome, Firefox, Safari, Opera, etc.), just that the names of the options might be a bit different. Once you start using Step Debugging via the Developer tools, you won’t have to write console.log() statements in order to determine the values of variables you are trying to debug.
Refer this screencast to learn more about Chrome Developers tool