OK, we want this page to do things so we need to write instructions in JS to affect either HTML or CSS. A great first step is to make a variable and set it equal to document. This doesn't do anything yet and is wrong but it gets us used to the following format:
Well I just told you var box = document; was wrong, maybe we can refine it a little. We'll use a built-in JS method to do that: querySelector(). Basically we want to select a piece of our Document or Page. We have to be careful about notation though. Try the to commit the following to memory:
Object.Method()
In our example that looks like: document.querySelector();
Now we have all the tools to tell JS how to 'select' our Box. Insert ".box" inside of the parentheses of querySelector(). Recall that ".box" is the name of our CSS class.
Once we finish with the variable, we need to take some time to think about what to do with it. It would be great to setup something called an Event Listener that waits for something to happen on the screen. To detect a cursor hovering over our box. Try the "mouseover" event. An Event Listener also does something when it 'hears' an event, but we'll manage that next step.
Let's setup an unnamed function to handle our event. These types of unnamed functions are called anonymous. A function has a couple of key elements:
name(parameters){ }
Our function is anonymous so we include the word function instead of a name. A parameter is information we can use inside of a function. Lastly the curly brackets just tell us where our function begins and ends. Naturally all code we want to add to it start inside them. Let's put our function right next to the comma after mouseover and before the parentheses ends.
Lastly let's add the line of code "alert("Hello, World!)" inside of our function. Make sure it's all inside the curly brackets.
Now when you hover over the box it finally does something and it's annoying! No worries, we'll make it cooler later. Also take a second to appreciate all you did in this challenge there was a lot thrown at you fast.