breakContinue标签使用

<html>
	<head>
		<meta charset="UTF-8">
		<title>异常捕获</title>
	</head>
	<body>
		<p>本例调用的函数会执行一个计算,然后返回结果:</p>
		<p id="demo"></p>
		<input name="bn" type="button" onclick="myMethod(12,3);">
	</body>
	<script type="text/javascript">
		function myMethod(a, b) {
			var x = "";
			var i = 0;
			var j = 0;
			for (i = 0; i < 5; i++) {
				for (j = 0; j < 5; j++) {
					if (i == 3) break;
					x += "i=" + i + " j=" + j + "\n";
				}
			}
			alert(x);
		}
	</script>
</html>

猜你喜欢

转载自blog.csdn.net/qq_36521848/article/details/84331150
今日推荐