维科纳蒂 »
×
改变方向
在 Codepen 上打开
更改主题,深色/浅色
<!DOCTYPE html> <html> <body> <h2>JavaScript break</h2> <p id="demo"></p> <script> const cars = ["BMW", "Volvo", "Saab", "Ford"]; let 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>