本文档基于 CC协议(Creative Commons Share-Alike License)发布,是developer.mozilla.com, www.mozref.comwww.aptana.com共同劳动的成果。

break

Breaks out of the current loop, switch, or labeled statement.

Syntax

break [label];

Example

function testBreak(x) {
   var i = 0;
   while (i < 6) {
      if (i == 3)
         break; //Breaks out of the while loop when i == 3.
      i++;
   }
   return i * x;
}