Snippets Collections
<ul id="birds">
  <li>Orange-winged parrot</li>
  <li class="endangered">Philippine eagle</li>
  <li>Great white pelican</li>
</ul>



<script>
    
const birds = document.querySelectorAll('li');

for (const bird of birds) {
  if (bird.matches('.endangered')) {
    console.log(`The ${bird.textContent} is endangered!`);
  }
}

    </script>
star

Thu Oct 06 2022 05:55:26 GMT+0000 (Coordinated Universal Time)

#javascript #matches #classes #find

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension