- Operators allow manipulating values and variables in code.
- Arithmetic operators:
- Addition +
- Subtraction -
- Multiplication *
- Division /
- Modulo %
- Exponentiation **
- Comparison operators
- Equal to ==
- Not equal !=
- Greater than >
- Less than <
- Greater than or equal >=
- Less than or equal <=
- Logical operators
- Order of operations determines evaluation order:
- Parentheses
- Exponents
- Multiplication/Division
- Addition/Subtraction
- Examples of expressions:
let area = 3.14 * radius * radius;
let isEligible = (age >= 18) && (income > 10000);
- Operator precedence and association rules apply. Use parentheses to control order.
- Common mistakes like confusing = and ==
The goal is to explain each type of operator with example usages so readers can use them effectively in webscript programs and understand how complex expressions are evaluated.