1. Home
  2. Computing & Technology
  3. JavaScript

Break

By , About.com Guide

Definition: The break statement terminates execution of a block of code earlier than normal. It either breaks out of the closest block of code if by itself or it can break out of a labelled block at a higher level by specifying the name of the block to break out of. The most common use for the break statement is within a switch block where it is used to break out of the switch block after the appropriate code for the matching case has been run. Break is a reserved word and cannot be used for anything other than declaring a break statement.
Examples:
if (a == b) break;
Explore JavaScript
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. JavaScript
  4. Reference
  5. Javascript Glossary - Break

©2009 About.com, a part of The New York Times Company.

All rights reserved.