Selecting Elements Safely
Use querySelector for single element and querySelectorAll for NodeList collections.
Check for null before manipulating selected elements to prevent runtime errors.
Prefer semantic selectors and data attributes for robust targeting.