In this lesson we learned how to use the javascript operators.
- 5 + 2 = 7
- 5 - 2 = 3
- 5 * 2 = 10
- 5 / 2 = 2.5
- 5 % 2 = 1
- 5 ** 2 = 25
The arithmetic operators, in javascript, follows the standard precedence of math operators.
- n = 2
- n += 2
- n -= 2
- n *= 2
- n /= 2
- n %= 2
- n %= 2
- n **= 2
- n++
- n--
- >: greater than;
- <: less than;
- >=: greater or equal than;
- <=: less or equal than;
- ==: equal to;
- !=: different to.
The result of an relational operation is a boolean value.
In javascript exists the identity operator: ===. This operator tests if the operators are identical.
- !: negation (not);
- &&: conjunction (and);
- ||: disjunction (or).
In javascript we have a special type of operator: the ternary operator. This operator is identified by ? and : symbols.
test ? true : false
- Arithmetic;
- Relational;
- Negation;
- Conjunction;
- Disjunction;
- Ternary;
- Assignment.