To debug Javascript you may try below.
Add debugger; keyword above the line from where you want to start debugging.
function Test() {
debugger;
var abc = 'something';
}
1) IE - Click on Tools -> Internet Options -> Advanced
Uncheck below options.
a) Disable script debugging (Internet Explorer)
b) Disable script debugging (Other)
2) Firefox - You can debug using Firebug - Script Tab.