Method 1. Open .js file in Visual Studio and insert breakpoint at the line you want to debug. Open Attach to Process dialog window (menu item Debug | Attach to Process...) and attach to Internet Explorer process (iexplore.exe). Execute the code you want to debug in Internet Explorer.
Method 2. Write your JavaScript and place the debugger
keyword where ever you want the code to break into debugging. The
JavaScript interpreter hits this keyword and halts execution and
returns the control back to the IDE. This is like setting a breakpoint
inside of Visual Studio.
Note: you must enable script debugging in Internet Explorer to be able to debug. Go to Internet Options inside Internet Explorer and then go to the Advanced tab. Uncheck Disable script debugging (Internet Explorer).