When you want to use JavaScript with a web page, you use the HTML

tags (but it is better to put scripts in their own files).

When the browser comes across a

load the script and then checks to see if it needs to do anything.

It is best to keep JavaScript code in its own JavaScript

file. JavaScript files are text files (like HTML pages and CSS style sheets), but they have the . j s extension. The HTML

A script is a series of instructions that a computer can follow one-by-one.

Each individual instruction or step is known as a statement. Statements should end with a semicolon.

You should write comments to explain what your code does.

They help make your code easier to read and understand. This can help you and others who read your code.

A script will have to temporarily

store the bits of information it needs to do its job. It can store this data in variables.

A variable is a good name for this

concept because the data stored in a variable can change (or vary) each time a script runs.

JavaScript distinguishes between numbers,

strings, and true or false values known as Booleans.

You can also use a technique

called escaping the quotation characters. This is done by using a backwards slash (or “backslash”) before any type of quote mark that appears within a string (as shown on the fourth line of this code sample). The backwards slash tells the interpreter that the following character is part of the string, rather than the end of it.

A Boolean variable can only have

a value of true or fa 1 se, but this data type is very helpful.

Programmers sometimes use

shorthand to create variables. Here are three variations of how to declare variables and assign them values

Once you have assigned a value

to a variable, you can then change what is stored in the variable later in the same script.

Here are six rules you must always follow when giving a variable a name: