Ví dụ
RUN
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <h1>Học lập trình miễn phí tại freetuts.net</h1> <p id="result"></p> <button onclick="myFunction()">Run</button> <script> function myFunction() { var text = ""; var i, j; Loop1: // The first for loop is labeled "Loop1" for (i = 0; i < 3; i++) { text += "<br>" + "i = " + i + ", j = "; Loop2: // The second for loop is labeled "Loop2" for (j = 10; j < 15; j++) { if (j === 12) { break Loop2; } document.getElementById("result").innerHTML = text += j + " "; } } } </script> </body> </html>
PHÓNG TO