Hard Reload
To See Menu |
Variables...
are names assigned to JavaScript statements. They may contain any letter,
numeral or the _ underscore character, but may not contain any of JavaScript's reserved
words. They are case sensitive.Variables must be declared within the script. This can be
done by simply stating a value for the variable, or using the reserved word var.
| legal
variables |
illegal
variables |
initializing
variables |
| myVariable |
my Variable |
var
myVariable |
| mytest_ |
my*test |
var mytest_
= new Array() |
| duck |
DUCK-Fart |
duck =
document.forms[0].elements[0].value |
A variables scope is determined by where it is declared. Variables that
are declared outside of any functions are global, and can be used by any function.
Variables declared within a function are local to that function, and child functions
nested within it.
Control Structures...
provide the backbone of performing JavaScript operations. They
instruct your script how to perform the task it is given. These structures take on
decision making and looping.
| Object Manipulation Statements |
|
|
|
| for...in |
loop through a single object |
| label |
labels
a statement |
| new |
creates a new instance of an object |
| this |
specifies
the current object |
| switch...case |
to test an object for multiple conditions |
| Operators |
|
|
|
| Arithmetic |
+, -, *, /, %, ++, --, - |
|
| Assignment |
=,
+=, -=, *=,/=, %= |
|
| Bitwise |
and(&), or( | ), or(^), <<, >>>, >> |
|
| Comparison |
==,
!=, >, <, >=, <= |
|
| Boolean |
&&, ||, ! |
|
|