Understanding Stack Traces
Printing stack traces
Printing log messages to the Web Inspector console is also very helpful in understanding how your application behaves. Now you can make the log entries even more informative by including associated stack traces. There are several ways of doing that.
Handling exceptions at runtime using window.onerror