Operators Worksheet

Question 1

What are the comparison operators used for?

They are used to compare 2 values or expressions.

Question 2

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

The logical AND (&&) operator returns true only if both conditions of either side are true.
The logical OR (||) operator returns true if at least one of the conditions is true.

Question 3

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

THe modulus operator (which is the dividing sign) is used to find he remainder of the division.

Question 4

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

You would use the not equal operator to check if the 2 values are 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.