Advanced Operators
Some advanced operators can be used, such as:
- Modulus (division remainder):
x = y % 2
- Increment: Given a = 5
c = a++
, Results: c = 5 and a = 6c = ++a
, Results: c = 6 and a = 6
- Decrement: Given a = 5
c = a--
, Results: c = 5 and a = 4c = --a
, Results: c = 4 and a = 4
Exercise
Correct!
var x = 10;
var c =
var x = 10; var c = (--x) % 3;
assert(c === 0);