ExpressionOperatorStatement (EO01)
1: 5; // Literal (number)
2: "hello"; // Literal (string)
3: x; // Variable
4: x + y; // Addition operation (combines variable and operator)
5: myFunction(a, b); // Function call
6: a > b ? a : b; // Ternary operator (conditional expression)
Expressions example
• Expressions produce values: Expressions are anything that resolves to a value (including assignments expressions).
• Operators act on values: Operators perform operations on values or variables (e.g., assignment, arithmetic, logic).
They form expressions by combining values.
• Expression statements are expressions that perform actions (cause side effects):
Many statements consist of expressions followed by semicolons.
These statements evaluate the expression primarily for its side effects.
This category includes assignment statements (which are distinct from assignment expressions as described above).
Assignment expressions produce a value (the assigned value) that you can use in an enclosing expression,
making them distinct from assignment statements which are not themselves expressions.
ExpressionOperatorStatement context:
ES6 context:
Comments (
)
)
Link to this page:
http://www.vb-net.com/JavascriptES6/EO01.htm
|
|