File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change 1- // operatorPrecedence.js
1+ /* INFO: Operator Precedence in JavaScript
22
3- // INFO: Operator Precedence in JavaScript
4-
5- /*
63Operator precedence determines the order in which parts of an expression are evaluated.
74
85Expressions with multiple operators are evaluated based on this precedence,
@@ -21,16 +18,12 @@ let score = 2 * 3 + 2 - 1;
2118Example 2: With parentheses (clear and recommended)
2219let score1 = ((2 * (3 + 2)) - 1);
2320// Evaluated as: 2 * (5) - 1 = 10 - 1 = 9
24-
25- ---
26-
27- Console outputs:
2821*/
2922
3023let score = 2 * 3 + 2 - 1 ;
31- let score1 = ( ( 2 * ( 3 + 2 ) ) - 1 ) ;
24+ let score1 = 2 * ( 3 + 2 ) - 1 ;
3225
33- console . log ( score ) ; // Output: 7
26+ console . log ( score ) ; // Output: 7
3427console . log ( score1 ) ; // Output: 9
3528
3629// TIP: Use parentheses to make your code easier to read and avoid unexpected results.
You can’t perform that action at this time.
0 commit comments