break

JavaScript 1.1+, ECMAScript 1.0+, JScript 1.0+ Nav3+, IE 3+, Opera3+ Syntax

break label;
						

Description

The keyword break provides a way to exit out of loop structures and switch conditionals prematurely. Most of the time, the word break appears on a line by itself, but there are times when a label will follow the keyword (see Table 6.21). When a label is used, code execution completely breaks out of the area designated by label and proceeds to the code that follows the area. To label a statement, simply place the label name followed by a colon (:) in front of the code that needs to be broken out of during code execution.

Table 6.21. Argument Associated with the break Keyword
Type Item Description
Argument label A label that designates ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.