<head>

<body>

 

<p>My list contains: </p>

<p id='for_each_example'></p>

 

<script>

var fruits = ['apple', 'cherry', 'pineapple']

    fruits.forEach(display)

    

    function display(item) {

     document.getElementById('for_each_example').innerHTML += item + '<br>'

    }

    

</script>

</body>

</html>

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.