Welcome back everybody.
All right so I'm just going to go ahead and actually get rid of this second paragraph tag right here.
It's pretty simple and I'll just go ahead and get rid of that too here so and we'll test everything
and everything still works OK.
Now in this Tauriel what I'm going to do is I'm going to talk to you about something called the variables.
Now I've told you that the function is like a box of code and that box of code will do something.
But if you can imagine a box a code with a whole bunch of other boxes that hold certain values.
OK.
And these values don't necessarily run code.
All they do is they're like numbers and names or something like that.
OK.
Now variables are really important and there are like a box of information really so you have the function
which is a box that does something and the variable is the box of information and variables are super
important because they can again be names they can be numbers or they can be a whole bunch of different
types of data.
Essentially what it is.
Right.
So first thing we're going to do in order to actually call the variable.
All we need to do is type in var OK.
And this var here is the center for variable and javascript's actually unique in that you don't have
to specify the type of variable.
So there's different kinds of variables.
There is something called a boolean variable which is true or false.
There's a integer variable which is numbers and their string variables which is character.
So if you want to make a string variable.
For example it would be like my name.
You can say your name anybody's name but what you couldn't do is you couldn't put a name inside an integer
variable or an int variable because integers are the only numbers.
There's no characters allowed and you couldn't put a number inside a boolean variable cause a booleans
will end true or false.
Now all we have to do in javascript is call the name so we can type in variable name just like this.
And there we go.
So now we have a variable that's all it is and we can have hundreds of these variables in fact if you're
making games or apps you generally have a lot of variables with with your program here and that's one
thing when you're learning about programming.
You see examples with two three four and maybe on the outside chance 10 variables.
But when you're actually developing you actually use quite a bit and especially when you're releasing
because you do have to you really have to add it in a bunch of data for pretty much a lot of things
that happened within the program.
So we have a variable name just like that.
So what we can do is we can go to Web site in variable number k and we'll type this again.
We call this variable name and you see him putting semi-colons at the end of this.
And there you go.
So the thing is is that these variables are the same thing.
Right now they're just variables they're just boxes.
Even will sign colors to these boxes.
OK.
So these are both a blank cardboard colored box.
OK.
But as soon as we do this and it's called initialising variables we type in equals zero.
Now what we've done is we've changed this variable from being a a string variable or just a blank variable
to an integer variable.
Now again javascript's since it doesn't really distinguish between strings and ense like other languages
do.
We can actually mash these together.
But for the most part to avoid errors you want to think of variable number as always going to be a number
is never going to be a string.
And in fact it's much better if you think this way because it will cause a lot of hard hardships down
the road.
Now let's go into variable name here.
So what we need to do is you need to put in two quotes like this and we're going to type in your name.
There we go.
Pretty simple right.
OK.
Now let's just do something cool here.
What we're going to do is we're going to go alert and watch this.
We're going to type in variable number just like that.
OK.
There we go.
Two warnings and if you change the text you see that it comes out to zero.
And if we type in variable name just like this James the it comes out as my name.
OK.
So if we change this to whatever we want let's say too and we change it back to variable number.
All right change the text and it comes out too.
So what it is is that this alert and whenever you see this any kind of any kind of brackets it means
you can put something in there.
OK.
So this alert here we typed in.
You know we typed in a string here OK and it came out as pop but we can also put in any kind of variable
we wanted to that and you'll also notice that there is a bracket here and that's for something really
different.
OK that's for something that's what you can put put variables into a function and they can do stuff.
But we don't really need to worry about that quite yet.
What I do want to show you is that you can actually go and put in variables wherever you want here.
Now watch this if we want to change the text to a variable name just like this.
We change the text and you can see that this is undefined here and the reason is is that I didn't put
anything there.
So let's just go ahead and put in a pop here.
OK.
And you'll also notice that when we do this here pop it does change to variable name.
OK so I'll just go ahead and delete this here and you'll see here that if I just expand this out a bit
it will be a little bit easier to look at.
So what you'll see is you see the document or get an idea paragraph text.
It's TMail equals two.
The variable name or we can make it even two variable number k just like that.
And if we change the text it changes too.
OK.
And so that's essentially what.
That's essentially how you use variables.
Again variables are really important because they can take in anything for example if you're making
a calculator app you can take in the variable that was typed in and then added to something which I'll
show you in the next tutorial.
I'll see you guys next time.