js for Loop Reverse Output Examples of Array Elements

  • 2021-07-24 09:55:39
  • OfStack

Examples are as follows:


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title> Output array elements in reverse order </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>

Related articles: