W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h2>JavaScript break</h2> <p id="demo"></p> <script> var cars = ["BMW", "Volvo", "porsche", "Ford"]; var text = ""; list: { text += cars[0] + "<br>"; text += cars[1] + "<br>"; break list; text += cars[2] + "<br>"; text += cars[3] + "<br>"; } document.getElementById("demo").innerHTML = text; </script> </body> </html>