Operators
You can apply mathematic operations to numbers using some basic operators like:
- Addition:
c = a + b
- Subtraction:
c = a - b
- Multiplication:
c = a * b
- Division:
c = a / b
You can use parentheses just like in math to separate and group expressions: c = (a / b) + d
Exercise
Correct!
var a = 2034547;
var b = 1.567;
var c = 6758.768;
var d = 45084;
var x =
var a = 2034547; var b = 1.567; var c = 6758.768; var d = 45084; var x = ((a + b) / c) * d;
assert(x === (((a + b) / c) * d));