Most browsers have a built-in JavaScript debugger that works like Visual Studio's debugger
Open the Chrome developer tools by pressing Ctrl+Shift+I
Select Sources tab, and select the file that contains the JavaScript
you want to debug on the left
Set a breakpoint by clicking on an executable line number (a breakpoint
was placed on line 26 below
When the line of JavaScript containing the breakpoint is about to be executed,
the browser will pause. You can step through the code using the buttons circled
(F10 to step over, F11 to step into, F8 to continue execution) and examine
variables by putting the mouse cursor on them or observing their values on the pane on
the right