Hey! Welcome back.
The last time we talked a bit about the DOM(document object model) and how we can manipulate, or make changes to it, without affecting the original HTML document. I made mention of using a method called .addEventListener() that contributes to this automated action but in order to talk about that, we have to clear up a few more things beforehand. So this post will be a bit of a detour on the way to learn about the ‘magic’ of the .addEventListener() function.
So now that they’re “connected” how does JS know what to do with the HTML? Let’s remember what we were working to accomplish the last time. We type a phrase into the input field, click the submit button and that phrase should appear on the page. Got it? Cool!
These two lines are both using the const keyword
Giving our variables a name
Finally, setting our variables equal to what we need to be selected in order to proceed with our intended DOM manipulation.
This is an example of basic variable assignment, something commonly used in JS. This added ability will bring us one step closer to accomplishing our goal of understanding basic DOM Manipulation. We need to discuss one more thing before we get to the route that we were on originally and that's functions.