Debugging javascript has been a really tidious task, especially in Internet Explorer. And if you're an EPiServer developer, you will have to debug some javascript in IE. I recently stumbeld upon this very hand statement: "debugger". Apparently it's been around for ages but I haven't noticied it before, so I thought I would make a quick post about it.
Example
The code is really easy:
function MyJavascriptFunction()
{
var i = 0:
var j = i + 1;
debugger;
}
Result
In Internet Explorer you will get the normal "Do you wish to debug" dialog box and just select yes:

And you will be able to debug in Visual Studio:

And in firefox it will open up Firebug:
And as you can see, it keeps the context you are in, very handy indeed.
Conclusion
It's not the best way to debug javascript, but it's really easy and will probably be enough in almost all cases. So start using the debugger statement now
Read more
http://msdn.microsoft.com/en-us/library/0bwt76sk(VS.85).aspx