Operation Hierarchy
EasyAcc. 88.4%
+25 XP 10
Logic Sequences
Equations in JavaScript follow strict Operator Precedence. Multiplication and division are prioritized over addition and subtraction.
- Solve the following expression using parameters
xandy: result = x + y * 2 - 4 / 2 - Return the final numeric result.
01EXAMPLE 1
Input
x = 10, y = 5Output
18Explanation: 10 + (5 * 2) - (4 / 2) = 10 + 10 - 2 = 18
Constraints
- Solve the expression exactly: x + y * 2 - 4 / 2.
- Return the result as a number.
FundamentalsMathPrecedence
JavaScriptSystem handles I/O — write your function only
Loading...
9 Hidden
Input Arguments
x10
y5
Expected Output
18
Click RUN to test your solution