This article explains you how to debug the client side Javascript code in VisualStudio.
Steps:
1.Go to IE. Open Tools>>Internet Options>>Advanced Tab.
2.Uncheck the "Disable Script Debugging" (Internet Explorer).
(http://www.c-sharpcorner.com/UploadFile/deepa_kunny/DebuggingclientsideJavascriptcode03292007081936AM/Images/Image1.jpg)
3.Write the Javascript code on aspx page and write "debugger;" statement inside your Javascript function and assign the breakpoint in Javascript code.
4.Run the application.
(http://www.c-sharpcorner.com/UploadFile/deepa_kunny/DebuggingclientsideJavascriptcode03292007081936AM/Images/Image2.jpg)
5.Now you can debug your application using Immediate window and find the error.
6.After debugging, remove the statement "debugger" from the Javascript code.