Tell me how to get a child by css selector or html tag

<div id="block"> <p class="one"></p> <p class="two"></p> <p class="tree"></p> </div> var block = document.getElementById('block'); 

How to get a paragraph with class two?
I want something like

 var paragraph = block.children('.two'); 

And of course this will not work.
How such things are solved on pure js

    1 answer 1

    All elements of the desired class:

     el = block.getElementsByClassName("two"); 

    The first element of the desired class:

      el = block.getElementsByClassName("two")[0]; 

    The local task also solves:

     el = block.children[1]; 
    • Thank you, man of tremendous - vetal
    • @vetal, if this answer helped - click the check mark in the upper left corner. - MedvedevDev
    • 3 days with this suffered, but it turns out everything is so simple) - vetal
    • and yes, I would not advise using the second option - MedvedevDev
    • four
      there is still this document.querySelector('#block .two'); - Rostyslav Kuzmovych