What is a Variable?A variable is a "container" for information you want to store. A variable's value can change during the script. You can refer to a variable by name to see its value or to change its value.
Ok, How do I use them?There are two ways you can start out a variable. You can use this;
<script>
var name = value
</script>
Or, you can use a shorter way:
<script>
name = value
</script>
It doesn't matter which one you use.
What exactly would I use them for?As you read above, variables are "containers". They can hold HTML, or text, or even other scripts just as Jquery and Javascript codes.
Here is an example of useing a variable for text...
<script>
name = "Text is being Used"
</script>
Now, that will not show anywhere because it doesn't have anything to make it show. To make it you would use this...
<script>
name = "Text is being Used"
document.write(name)
</script>
As you can see, the document.write() is holding the variable name, "name". So, the text that would show would be "Text is being Used" since that is the text in the variable.
You may use HTML in the variables. Just one thing you need to remember, you can't use double quotes, you must use Single Quotes.
That is basicly it for the variable tutorial. That is the best I can do it, I hope you get it and like the tutorial!