Variables and you use variables all the time what you know it or not…
Text of Video Follows:
Hi, this is William and I’m gonna take the file from our last lesson and change it back to a text file
and if you didn’t watch the last lesson that’s fine, just go ahead and make a new text file on the desktop.
I’ll open it up and get rid of the alert statement here
Now I’m going to tell you a bit about variables and you use variables all the time what you know it or not if you’ve ever in school had a place where it set name and an underline where to write your name name is the variable and the value is whatever you wrote down on that line.
whenever you fill out a form, you’re assigning values to variables so I’m going to make a variable by saying v-a-r
VAR short for variable I’m going to give the variable the name of name
and I’m going to assign of my own name
so name is the variable, William is the value and we always end the line with a semicolon ;
That will tell the computer that I’m done with this line let’s go on to the next one.
now gonna make it a variable of a different type called age, this one is going to be a number.
so William is a string
a string is what we call anything that’s text, so the two types of variables strings which are text and numbers
and string value should always be in quotes like this “My String”.
That tells the computer where to start the string and then where to end it.
and I’ll make a string right here in this alert statement
alert(“My Name is”
and if I put a + I can combine that with the name string
whenever the value is inside the name variable now make another string here by opening the quotes again
“, and I am ” +age); and always that semi-colon;
alert(“My Name is “+name+”, and I am “+age);
so we save that,close it and change the extension back to HTML,and double click
there we are now go and play around with the values put your own name and age and you can’t hurt anything you not to break your computer by doing this. if you have any questions on this or anything else with code we sleep in the comments section on Youtube