JAVASCRIPT Displays data
JavaScript can output data in different ways:
- Use the window.alert () pop- up warning box.
- Use the document.write () method to write content to an HTML document.
- Writes to an HTML element using InnerHTML .
- Use Console.log () to write to the browser's console
JavaScript Statement identifiers
JavaScript statements typically begin with a statement identifier and execute the statement.
Statement identifiers are reserved keywords that cannot be used as variable names.
The following table lists the JavaScript statement identifiers (keywords):
Statement |
Description |
Break |
Used to jump out of a loop. |
Catch |
Statement block that executes a catch statement block when a try statement block performs an error. |
Continue |
Skips an iteration in the loop. |
Do ... while |
Executes a block of statements that continues executing the statement block when the condition statement is true. |
For |
When the conditional statement is true, the code block can be executed a specified number of times. |
For ... in |
Used to iterate over an array or an object's properties (to iterate over a group or an object's properties). |
function |
Define a function |
If ... else |
Used to perform different actions based on different conditions. |
Return |
Exit function |
Switch |
Used to perform different actions based on different conditions. |
Throw |
Throws (generates) an error. |
Try |
Implements error handling and is used with catch. |
Var |
Declares a variable. |
While |
When the conditional statement is true, the statement block is executed. |
JS, JQ Intensive Review