Schleifen Sie durch htmlcollection

<script type="text/javascript">
        // get a HTMLCollection of elements in the page
        let collection = document.getElementsByTagName("p");//write your element
  
        // regular for loop
        for (let i = 0; i < collection.length; i++) {
            console.log(collection[i]);
        }
    </script>
Hussain Al-zadjali