The for of statement loops through the values of any iterable object.
It lets you loop over iterable data structures such as Arrays, Strings, Maps, NodeLists, and more
In the example below, the array of cars can be looped over and output the results in a list.
<p>Some of my favorite cars are:<br>
<span id="demo"></span></p>
<script>
const cars = ["BMW", "Volvo", "Mercedes", "Jaguar"];
let favCars = "";
for (let x of cars)
{favCars += x + "<br>"; }
document.getElementById("demo").innerHTML = favCars;
</script>
Some of my favorite cars are: