An expression is a combination of values, variables, and operators, which computes to a value.
The computation is called an evaluation.
For example, 5 * 10 evaluates to 50:
5 * 10
Expressions can also contain variable values:
x * 10
The values can be of various types, such as numbers and strings.
For example, "John" + " " + "Doe", evaluates to "John Doe":
"John" + " " + "Doe"
JavaScript keywords are used to identify actions to be performed.
The var
keyword tells the browser to create variables:
var x, y;
x = 5 + 6;
y = x * 10;
Not all JavaScript statements are "executed".
Code after double slashes //
or between /*
and */
is treated as a comment.
Comments are ignored, and will not be executed:
var x = 5; // I will be executed
// var x = 6; I will NOT be executed