Java Reference
In-Depth Information
Statement
Introduced
Description
while
JavaScript 1.0
Executes a block of statements if a test condition evaluates to
true . The loop then repeats, testing the condition with each
repeat, ceasing if the condition evaluates to false .
break
JavaScript 1.0
Used within a while or for loop to terminate the loop and
transfer program control to the statement following the loop.
Can also be used with a label to break to a particular program
position outside of the loop.
label
JavaScript 1.2
An identifi er that can be used with break or continue state-
ments to indicate where the program should continue execution
after the loop execution is stopped.
Execution Control Statements
Code execution is controlled in a variety of ways. In addition to the conditional and loop statements, the
following statements also contribute to execution control.
Statement
Introduced
Description
continue
JavaScript 1.0
Used to stop execution of the block of statements in the current
iteration of a while or for loop; execution of the loop contin-
ues with the next iteration.
return
JavaScript 1.0
Used to specify the value to be returned by a function.
with
JavaScript 1.0
Specifi es the default object for a block of code.
Exception Handling Statements
Errors are a natural part of programming, and JavaScript provides you the means to catch errors and
handle them gracefully.
Statement
Introduced
Description
throw
JavaScript 1.4
Throws a custom exception defi ned by the user.
try…catch
…finally
JavaScript 1.4
Executes the statements in the try block; if any exceptions
occur, these are handled in the catch block. The finally
block allows you to stipulate statements that will be executed
after both the try and catch statements.
Search WWH ::




Custom Search