Codington
0 of 6 problems solved • 0%
Use in a course

Exercise prompt

Repair the Calculation

JavaScript multiplies before it adds. Parentheses make part of a calculation happen first.

Example

console.log((1 + 2) * 5);

The parentheses make 1 + 2 happen first, so the console displays 15.

Your task

The starter displays 14. Add one pair of parentheses so it adds 2 + 3 before multiplying by 4, producing 20. Keep the numbers and operators.

Hint

Say the calculation in the order you want JavaScript to perform it.