Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Statements</h1>
<h2>The while Statement</h2>
<p>Loop over an array in descending order (negative increment):</p>
<p id="demo"></p>
<script>
const cars = ["BMW", "Volvo", "Saab", "Ford"];
let text = "";
let len = cars.length;
while (len--) {
  text += cars[len] + "<br>";
}
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>