
5. Statements
| Statement | Syntax | Support | Remark |
|---|---|---|---|
| Block Statement |
{ StatementList } | Yes | |
| Variable Statement | var varname [= value] [..., varname [= value]] | Yes | |
| Empty Statement | ; | Yes | |
| Expression Statement |
[lookahead notin {{, function}] Expression ; | Yes | |
| if Statement | if ( Expression ) Statement else Statement | Yes | |
| if ( Expression ) Statement | Yes | ||
| Iteration Statements | do Statement while ( Expression ) ; | Yes | In NF3, if the loop timer reaches the limit, it stops executing the script. The default limit is 1,000,000. If built-in function is called or DOM method is executed in the loop, the process may escape from the loop before it reaches the limit. |
| while ( Expression ) Statement | Yes | In NF3, if the loop timer reaches the limit, it stops executing the script. The default limit is 1,000,000. If built-in function is called or DOM method is executed in the loop, the process may escape from the loop before it reaches the limit. |
|
| for ( ExpressionNoIn; Expression; Expression ) Statement | Yes | In NF3, if the loop timer reaches the limit, it stops executing the script. The default limit is 1,000,000. If built-in function is called or DOM method is executed in the loop, the process may escape from the loop before it reaches the limit. |
|
| for ( var VariableDeclarationListNoIn; Expression; Expression ) Statement | Yes | ||
| for ( LeftHandSideExpression in Expression ) Statement | Yes | In NF3, if the loop timer reaches the limit, it stops executing the script. The default limit is 1,000,000. If built-in function is called or DOM method is executed in the loop, the process may escape from the loop before it reaches the limit. |
|
| for ( var VariableDeclarationNoIn in Expression ) Statement | Yes | ||
| continue Statement | continue [ no LineTerminator here ] Identifier ; | Yes | |
| break Statement | break [ no LineTerminator here ] Identifier ; | Yes | |
| return Statement | return [ no LineTerminator here ] Expression ; | Yes | |
| with Statement | with ( Expression ) Statement | Yes | |
| switch Statement | [ SwitchStatement :] switch ( Expression ) CaseBlock [ CaseBlock :] { CaseClauses } { CaseClauses DefaultClause CaseClauses } [ CaseClauses :] CaseClause CaseClauses CaseClause [ CaseClause :] case Expression : StatementList [ DefaultClause :] default : StatementList |
Yes | |
| labelled Statement | Identifier : statements |
Yes | |
| throw Statement | throw [ no LineTerminator here ] Expression ; | Yes | |
| try Statement | [ TryStatement :] try Block Catch try Block Finally try Block Catch Finally [ Catch :] catch ( Identifier ) Block [ Finally :] finally Block |
Yes | |
| function Definition | [ FunctionDeclaration :] function Identifier ( FormalParameterList ) { FunctionBody } [ FormalParameterList :] Identifier FormalParameterList , Identifier [ FunctionBody :] SourceElements |
Yes | |
| [ FunctionExpression :] function Identifieropt ( FormalParameterList ) { FunctionBody } [ FormalParameterList :] Identifier FormalParameterList , Identifier [ FunctionBody :] SourceElements |
Yes | ||
| Comments | // comment text | Yes | |
| /* multiple line comment text */ | Yes | ||
| export Statement | export name1, name2, ..., nameN | No | |
| export * | No | ||
| import Statement | import objectName. name1, objectName. name2,...,objectName. nameN | No | |
| import objectName.* | No |

