Professional Documents
Culture Documents
JavaScript allow us to solve algebraic expressions. operator
We have some operators available in JS!
2+3
+ addition
- subtraction
* multiplication
/ division operands
** exponentiation
% modulus (division remainder)
Assignment Operators
There is a shortcut assignment in JS when we want to assign to a variable (x) the result
of an operation of it's own value with another value (y).
Name Operator Equivalent
Assignment x=y N/A
Addition x += y x=x+y
Substraction x -= y x = x -y
Multiplication x *= y x=x*y
Division x /= y x=x/y
Remainder x %= y x = x% y
Exponentiation x ** = y x= x**y
Auto-Increment Operators
There is also an auto-increment and auto-decrement operator
available in JavaScript. All it does is increase/decrease by one the
variable.
x++ // x = x + 1
x-- // x = x - 1
It has nothing special to it, it’s just shorter & cleaner!
What are Expressions
// === 10 + 5 * 8 / 4 - 6
// === 10 + 40 / 4 - 6
Precedence Operator
// === 10 + 10 - 6 1 ()
2 **
// === 10 + 4
3 *
// ==> 14 4 /
5 +
6 -