Home > Web Front-end > JS Tutorial > js for loop outputs array elements in reverse order

js for loop outputs array elements in reverse order

高洛峰
Release: 2017-03-01 16:02:23
Original
3242 people have browsed it

The following editor will bring you an example of js for loop outputting array elements in reverse order. The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor and take a look.

The examples are as follows:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>倒序输出数组元素</title>
</head>
<body>
<script type="text/javascript">
var a=[1,2,3,4]
for(var i=a.length-1;i>=0;i--){
document.write(a[i]+&#39;<br>&#39;);}
</script>
hellp
</body>
</html>
Copy after login

The above The example of js for loop outputting array elements in reverse order is all the content shared by the editor. I hope it can give you a reference, and I hope you will support the PHP Chinese website.

For more articles related to js for loop outputting array elements in reverse order, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template