The browser storage localStorage is not available. Either your browser does not support it or you have disabled it or the maximum memory size is exceeded. Without localStorage your solutions will not be stored.
Parentheses
Just as in mathematics, the order of operations rules are valid in JavaScript. Multiplication and
division are performed before addition and subtraction. With parentheses you can specify the order of operations.
let x1 = 3 + 4 * 2;
let x2 = (3 + 4) * 2;
x1
is 11
and x2
is 14
.Exercise
Write a function
Example:
mean
that takes 2 numbers and returns their mean value.Example:
mean(1, 2)
should return 1.5
.
+ Hint
The mean value of two numbers
x and y is (x + y) / 2.
+ Solution
function mean(x, y) {
return (x + y) / 2;
}