We've gone to the first exercise this first exercise not going to be too difficult. We haven't covered a whole lot yet. Let me tell you what your assignment is. In the exercise files for exercise one, you will have an HTML file learned, yes, that HTML, it's linked to a main dot CSS stylesheet. And there's also an image JavaScript logo. Those are the three files which will have an exercise one, your assignment is to create a JavaScript file, attach it to the HTML file.
Then in the JavaScript file, create a variable for your first name, a variable for your last name, and then do a console dot log to print the first name and last name to the console. Give that a try. Try it out. See make sure it works. Go ahead and pause the video at this time. And then when you're done, unpause and we'll continue with the assignment.
Alright, hopefully that worked out for you. Okay. So the first thing I'm going to do is create a new file. I'm going to call it app dot j s, and I'm going to save it. Now I want to link that file to my HTML file. So I'm going to go down to the bottom of the body tag, enter a script tag, and remove the type.
And then for the source attribute, I'm going to enter the path to the JavaScript file. Now since the JavaScript files in the same folder, as the HTML file, the path is simply the name of that file. If it were in a subfolder, I would have to enter the path to that sub folder and then the file name. Alright, I've got those links. I'm going to go ahead and save my HTML file. Now.
And jump to the JavaScript file. First we'll create a first name variable and set that equal to my first name. Put the semicolon at the end and create a last name variable and set that equal to my last name, also using the semi colon. Now we'll do the console dot log display first name, and I'm going to concatenate it to a space. And I do that by entering a space inside of quotes. Then I'll concatenate that to the last name.
So we'll put those two variables together with a space in between and close that with a semicolon. And we'll go ahead and save it. Now let's give that a try. copy the file path so I can paste it into the browser. Bring up that HTML file. So there's the HTML file, I need to display the JavaScript console.
And here's the JavaScript console. And sure enough, my name displays with a space in between it. So if you're able to arrive at those results, congratulations. Obviously this was a very simple exercise. They'll get a little bit hard from here on out, but let's move on to the next topic.