Expression

Expressions are utilized to assign values to variables. An expression typically consists of variables, constants, operators, and functions, arranged in a specific order to perform a computation or evaluation. These expressions can range from simple assignments to complex calculations, facilitating various operations within the programming environment.

Operators

  1. . - Dot operator used to access attributes and methods

  2. [] - Square operator used to access elements of arrays

  3. () - Parentheses, also known as round brackets or simply brackets, are punctuation marks used in 3 purposes.

    1. Grouping and Clarity: Parentheses are used to group elements within a expression to indicate a specific order of operations or to enhance readability. They help clarify the structure and meaning of a sentence by enclosing supplementary information or clarifications.

      Example:

      • I enjoy eating (especially chocolate) when I'm stressed.

      • (x + y) * (x - y) (to indicate that addition comes before subtraction)

    2. Mathematical Expressions: In mathematical expressions, parentheses are used to indicate precedence or to specify the order of operations. Operations within parentheses are performed before those outside of parentheses.

      Example:

      • (3 + 5) * 2 is evaluated differently than 3 + (5 * 2)

    3. Function Calls: parentheses are used to denote function calls. When calling a function, the arguments (if any) are placed within the parentheses.

      Example:

      • Math.pow(2, 4) (calling the pow function with the arguments 2 and 4)

  4. + - * / - math operators

  5. = < > <= >= != - numbers comparison operators

  6. and or not - boolean operators

Variables

List of available variables depends on scope (node position). Variables can be:

Functions

See Expression functions page for more details.

Last updated