Class:BCOM IIyr
1. Expression
An expression in JavaScript is a combination of values, variables, and operators that is evaluated to produce a single value.
Example
Explanation:
This expression evaluates to 8.
Another example:
Here, x > 10 is an expression that produces true or false.
2. Operator Precedence
Operator precedence is the rule that determines which operator is evaluated first when an expression contains more than one operator.
Example
Explanation:
Multiplication (*) has higher precedence than addition (+), so:
Using parentheses:
Now the result is:
0 comments:
Post a Comment