Question-1: What are the different ways to select an element in the DOM?
We can select DOM elements in several ways:
document.getElementById('id')selects one element by its ID.document.getElementsByClassName('class')selects elements by class name.document.getElementsByTagName('tag')selects elements by tag name.document.querySelector('selector')selects the first matching CSS selector.document.querySelectorAll('selector')selects all matching CSS selectors.