for循环

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ytlxl/article/details/79978415
<!DOCTYPE html>
<html>
<head>
	<title>LIAOXIANLI</title>
	<script type="text/javascript">
		cars=["BMW","Volvo","Saab","Ford"];
		for (var i = cars.length - 1; i >= 0; i--) {
			document.write(cars[cars.length-i-1]+"<br>");
		}
	</script>
</head>
<body>

</body>
</html>
for后面的i从cars.length-1递减,小于0时退出循环
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页