Variables in JavaScript

Notes from April 6, 2005 class

A Variable represents or holds a value.

var variablename=variablevalue;

Variables

If a variable is a string:

Special characters:

This is translated by Javascript into this
\\   \
\t   tab
\"   "
\n   newline

There are several other special characters. Check the textbook for the complete list.

Boolean operators

You can set a variable to either true (1) or false (0).

(We won't be using Boolean operators for a while, but I wanted to get the concept recorded into the class notes now.)