Operators and expressions
Operators allow you to get two simple expressions and combine them to form a more complex expression.
But first.. what is an expression? An expression is a single unit of JavaScript code that the JavaScript engine can evaluate, and return a value.
An expression can be a literal, like a string or a number.
It can also be an identifier that points to a variable.
Like these:
We also have other kinds of expressions.
Arithmetic expressions are expressions that take a variable and an operator (more on operators soon), and result in a number:
String expressions are expressions that result in a string:
Logical expressions make use of logical operators and resolve to a boolean value:
More advanced expressions involve objects, functions, and arrays, and I’ll introduce them later.
Last updated
Was this helpful?