Exceptions are generally categorized in 2 types:
System Error: Caused by browser/code because of unknown reason(s).
Application Error: Caused by a piece of code where the scenario in which an error can occur is not handled by the developer.
Break and continue statements are part of almost every programming language. They provides ability to stop/skip the execution in a program flow. These statements are only used inside a loop or switch statement. They are not valid outside of switch/loop statement.
Break statement is most frequently used inside switch statement and is part of every case block. Whenever a break is encountered after a case, execution is immediately sent out of switch. Similarily when it is used inside a loop, once break is found, execution comes out of loop. Break statement says, "Exit the loop."
Alert, prompt and document.write functions are most commonly used for user interaction and writing some content on browser window.
- Alert is used to display some warning message window
- Prompt is used to capture user input
- Confirm is used to capture Yes/No or OK/Cancel response from user in order to perform further activity
- Write is used to write some text on browser window.
Below are some examples of using these functions.
Using Alert function:
var browserInfo = '';
browserInfo = "Browser CodeName: " + navigator.appCodeName + "\n\r";
browserInfo += "Browser Name: " + navigator.appName + "\n\r";
browserInfo += "Browser Version: " + navigator.appVersion + "\n\r";
browserInfo += "Cookies Enabled: " + navigator.cookieEnabled + "\n\r";
browserInfo += "Platform: " + navigator.platform + "\n\r";
browserInfo += "User Agent: " + navigator.userAgent + "\n\r";
What is scripting language? "Scripting language is not compiled rather it is interpreted. VBScript and Perl are other scripting languages."