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.

  1. Solve the following expression using parameters x and y: result = x + y * 2 - 4 / 2
  2. Return the final numeric result.

01EXAMPLE 1

Inputx = 10, y = 5
Output18

Explanation: 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
JavaScript
Loading...
9 Hidden

Input Arguments

x10
y5

Expected Output

18

Click RUN to test your solution