OK.
So it's time again for a few quick javascript function exercises.
So like the first few problem sets I'm not going to have you actually write code just yet.
I'm just going to give you a function here and a little bit of code and I'd like for you to evaluate
what happens when I run this code.
So go ahead.
Pause the video and then we'll talk about what actually happens in just a few moments.
So in this code we're declaring a function called test and it takes two arguments x and y and then all
that it does is a returned Y which is the second argument minus X which is the first.
So when I called test here with 10 and 40 X is going to be 10 y is going to be 40.
So we end up with a return 40 minus 10 which should return 30.
So let's verify that by opening up the cancel and pasting the code in.
And you can see we get 30 great.
OK.
So we have one more here.
This is another function also called test like for you to pause the video and evaluate what happens
when we run this code.
OK so this function test takes a single argument x and then it returned X times 2 and then it looks
like it also confidant logs X and then it returns X divided by two.
But if you'll remember from the video on the return key word as soon as we return something execution
of a function stops.
So when we return x times 2 the function is over.
And so neither of these lines actually runs.
So test 40 is going to return 80 and then that's it.
So to verify that open up the con..
Paste this in and you can see we get 80 but we never get counted out log 40 or return 20