Cara menargetkan elemen HTML di JavaScript

// HOW TO GET ELEMENT BY CLASS

const gotIt = document.querySelector('.theElement');
//<p class="theElement">This is the element you are targeting.</p>    <----html

// HOW TO GET ELEMENT BY ID

const gotIt = document.querySelector("#get-residents")
//<button id="get-residents">get residents</button>              <---- html
Different Dugong