Conceptually, there are two types of expressions: those that assign a value to a variable, and those that simply have a value. For example, the expression `x = 7`

is an expression that assigns x the value seven. This expression itself evaluates to seven. Such expressions use *assignment operators.* On the other hand, the expression `3 + 4`

simply evaluates to seven; it does not perform an assignment. The operators used in such expressions are referred to simply as *operators*.

JavaScript has the following types of expressions:

- Arithmetic: evaluates to a number, for example 3.14159
- String: evaluates to a character string, for example, "Fred" or "234"
- Logical: evaluates to true or false
The special keyword
**null**denotes a null value. In contrast, variables that have not been assigned a value are*undefined*and will cause a runtime error if used as numbers or as numeric variables.

(Ifcondition) ?val1:val2

status = (age >= 18) ? "adult" : "minor"This statement assigns the value "adult" to the variable

The other operators are shorthand for standard operations, as shown in the following table:

For example,operand1 operator operand2

`3+4`

or `x*y`

.A unary operator requires a single operand, either before or after the operator:

oroperator operand

For example,operand operator

`x++`

or `++x`

.var1 % var2The modulus operator returns the first operand modulo the second operand, that is,

`x = -x`

negates the value of x; that is, if x were three, it would become -3.The following table summarizes JavaScript's bitwise operators

- The operands are converted to thirty-two-bit integers and expressed by a series of bits (zeros and ones).
- Each bit in the first operand is paired with the corresponding bit in the second operand: first bit to first bit, second bit to second bit, and so on.
- The operator is applied to each pair of bits, and the result is constructed bitwise. For example, the binary representation of nine is 1001, and the binary representation of fifteen is 1111. So, when the bitwise operators are applied to these values, the results are as follows:
- 15 & 9 yields 9 (1111 & 1001 = 1001)
- 15 | 9 yields 15 (1111 | 1001 = 1111)
- 15 ^ 9 yields 6 (1111 ^ 1001 = 0110)

Shift operators convert their operands to thirty-two-bit integers and return a result of the same type as the left operator.

For example, 9<<2 yields thirty-six, because 1001 shifted two bits to the left becomes 100100, which is thirty-six.

For example, 9>>2 yields two, because 1001 shifted two bits to the right becomes 10, which is two. Likewise, -9>>2 yields -3, because the sign is preserved.

For example, 19>>>2 yields four, because 10011 shifted two bits to the right becomes 100, which is four. For non-negative numbers, zero-fill right shift and sign-propagating right shift yield the same result.

**false**&&*anything*is short-circuit evaluated to false.**true**||*anything*is short-circuit evaluated to true. The rules of logic guarantee that these evaluations are always correct. Note that the*anything*part of the above expressions is not evaluated, so any side effects of doing so do not take effect.

`"my " + "string"`

returns the string `"my string".`

The shorthand assignment operator += can also be used to concatenate strings. For example, if the variable *mystring* has the value "alpha," then the expression `mystring += "bet"`

evaluates to "alphabet" and assigns this value to *mystring*.

The following table describes the precedence of operators, from lowest to highest: