Home >Web Front-end >JS Tutorial >What are the javascript statements?
Javascript statements include: 1. break statement, used to jump out of the loop; 2. catch statement, executed when an error occurs in the try statement block; 3. continue statement, used to skip one of the loops Iteration; 4. For statement, execute the code block a specified number of times, etc.
The operating environment of this article: windows7 system, javascript version 1.8.5, DELL G3 computer
What are the javascript statements?
JavaScript statement identifier
JavaScript statements usually start with a statement identifier and execute the statement.
Statement identifiers are reserved keywords and cannot be used as variable names.
The JavaScript statement identifiers (keywords) are listed below:
JavaScript Statement
break: used to break out of the loop.
catch: statement block, execute the catch statement block when an error occurs during the execution of the try statement block.
continue: Skip an iteration in the loop.
do ... while: Execute a statement block and continue executing the statement block when the conditional 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 traverse the properties of an array or object (loop through the properties of an array or object).
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: Throw (generate) error.
try: Implement error handling, used with catch.
var: declare a variable.
while: When the conditional statement is true, execute the statement block.
Recommended study: "javascript Advanced Tutorial"
The above is the detailed content of What are the javascript statements?. For more information, please follow other related articles on the PHP Chinese website!