Home > Article > Web Front-end > js for loop outputs array elements in reverse order
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]+'<br>');} </script> hellp </body> </html>
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!