Operators Worksheet

Question 1

What are the comparison operators used for?

Boolean expressions

Question 2

Explain the difference between the logical AND operator (&&) and the logical OR operator (||).

&& means both A and B must be true
Ex) x > 7 && y < 7

|| means A or B must be true, both could be true but as long as 1 is true it will count as true.
Ex) x == "y" || x == "Y"

Question 3

Which operator would you use to find the remainder from dividing 2 numbers.

%

Question 4

Which operator would you use if you wanted to find out if two values were NOT equal?

!=

Coding Problems - See the 'script' tag below this h3 tag. You will have to write some JavaScript code in it.

Always test your work! Check the console log to make sure there are no errors.