Operators Flashcards
1
Q
Multiply 10 with 5, and alert the result:
A
alert(10 * 5);
2
Q
Divide 10 by 2, and alert the result:
A
alert(10 / 2);
3
Q
Alert the remainder when 15 is divided by 9.
A
alert(15 % 9);
4
Q
Use the correct assignment operator that will result in x being 15 (same as x = x + y).
x = 10;
y = 5;
A
x += y;
5
Q
Use the correct assignment operator that will result in x being 50 (same as x = x * y).
x = 10;
y = 5;
A
x *= y;
6
Q
x = 3;
decrement x by 1
A
x–
7
Q
c = 6;
increment c by 1
A
c++
8
Q
x = 3;
What’s the shortcut for multiplying x by 4?
A
x *= 4
9
Q
y = 25;
What’s the shortcut for dividing x by 5?
A
y /= 5