<html>
<body>
<p>List all array items, with keys and values:</p>
<p id="demo"></p>
<script>
var fruits = ["apple", "orange", "cherry"];
fruits.forEach(myFunction);
function myFunction(item, index) {
document.getElementById("demo").innerHTML += index + ":" + item + "<br>";
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_foreach by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:01:26 GMT -->
</html>