let featuredTitle = document.querySelector('h1') featuredTitle.id = 'featured-title'
Here’s what’s happening in the video:
- First, we find the h1 element on the web page and assign it to a variable called
- Then we attach an ID attribute to that variable via dot notation (variableName.attribute) in this case:
featuredTitle.idand give it a value of
You can do this to any existing element in the DOM.