Javascript examples for Statement:for
Normally, break only breaks the immediate loop. This one breaks the loop labelled as dance.
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {// w ww. j a v a 2 s. c om var i, j; dance: for (i = 0; i < 20; i++) { for (j = 0; j < 20; j++) { console.log(i+'-'+j); if (j === 10) { break dance; } } } }); </script> </head> <body> </body> </html>