JavaScript
JavaScript Break 和 Continue 语句
通过标签引用,break 语句可用于跳出任何 JavaScript 代码块
源代码:
点击运行 »
<script> cars = ["BMW", "Volvo", "Saab", "Ford"]; list: { document.write(cars[0] + "<br>"); document.write(cars[1] + "<br>"); document.write(cars[2] + "<br>"); break list; document.write(cars[3] + "<br>"); document.write(cars[4] + "<br>"); document.write(cars[5] + "<br>"); } </script>
运行结果:
点击运行 »