Variables and basic syntax
In order to use a variable, you must declare it with the keyword var. Here's how you do it:
var x = 7;
A couple things to note here. First is that the word var precedes the name of the variable. The second is that the assignment of the variable is pretty much what you'd expect: x = 7. All that means is that the value of x is equal to the number 7. Third is that after the assignment, there's a semicolon. You know how in English, you usually end sentences with periods? Well, think of the assignment as a sentence. The semicolon is like a period; it tells the computer that your "sentence" is done.
var x = "Hello World!";
You can also set a variable to equal another variable, like so:
var x = 8; var y = x;
Now y is equal to 8.