In this lesson, we're going to look at the pivotal role of functions in JavaScript, and a good way to point that out would be to look at what the language would be without functions. We'd have a lot of code that we would need to repeat. Let's say I'm just doing this simple process, all I want to do is verify the two variables or numbers, add them together, and display the result on the page. Now that's not a lot of code, I'm just doing it one time. But let's say I want to do it with two different variables. If we didn't have functions, I would need to repeat the code for that entire process, and yeah, maybe I could copy and paste, but I would still need to make sure that all the specific variable names were changed and everything else that goes with that. That's why we want to have functions, a set of reusable statements with a name, so we can call that function and have it do something or return a value or both. And this would be a good time to talk about where your script goes, how to organize. Typically your functions are in separate script files arranged according to their use. So since you're going to link to script from an HTML page, typically you might modularize your code by having all the functions for one page in a certain file. What I've done here in Visual Studio is created a scripts folder, nothing magic about the name. It's just called scripts by convention, and I've got my function in here. This will take care of all the code that we've got on the main page that had to repeat. This function accepts parameters, values that we pass in, so it knows how to do its job. And at the end it writes the message back out to the page, we could even change it and have it return a value as well. But for this one, I'm just trying to duplicate what I had on the main page. The next thing I need to do would be to make that script available to this page. And in order to do that, I create a script link. And in fact, this is really easy to do from Solution Explorer. You can actually just click on the file name itself and drag it right here into the page, and it will create that link right there for you. It makes the function or functions that I've declared in that file available to the page. So I can get rid of all this repeating code, because this is all going to be taken care of by the function that I call. I'm just going to leave the variable declarations in there, and I'll put my call in to the function and make sure everything is going to post in the location that I want it. And notice you can even mouse over the function call. And you can tell that functions recognize because the tool tip shows us the parameter names. OK, so we've got that save. Let's take a look at this and see if it actually works. Looks like it did. 10 plus 11 is 21, and the second one would be these variables. And we give the message that we can't add non-numerical values there. So we want to use functions to create powerful sets of reusable code. Thanks for watching. Stay tuned. Our next lesson we'll talk about declaring functions using local variables and passing parameters.