Learn to output debugging information using various techniques.
But use of alert window method was tedious and not full proof, hence they got replaced by various other techniques.
error(msg) : Used to log an error message to the Browser Console
info(msg) : Used to log an informational message to the Browser Console
log(msg) : Used to log a general message to the Browser Console
warn(msg) : Used to log a warning message to the Browser Console
Google Chrome : CTRL + SHIFT + J to open console tab.
Apple Safari : CTRL + ALT + I to open Web Inspector.
Mozilla Firefox : CTRL + SHIFT + K to open Web Console tab.
Opera: CTRL + SHIFT + I to open Dragon Fly tab.
Internet Explorer : F12 to open Developer Tools, within which visit the "console" Tab.
Another innovative way to display debugging messages to the user is to specify an area on the webpage where the message can be displayed, and then write all messages there.
Another innovative way to debug code is by throwing errors.These errors messages must specify the exact nature of error and the causes
In order to throw a custom error use the function throwIt(), it checks for a condition to be true, and if the condition is false an error is thrown.