Operators Worksheet

Question 1

What are the comparison operators used for?

Comparison operators are used to compare two values. You can use them in Boolean expressions.

Question 2

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

The difference between the logical AND operator and the OR operator is that the AND operator allows you to see if two boolean expressions are true. And the OR operator allows you to see if one expression is true out of the two.

Question 3

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

The operator you would use to find the remainder from dividing 2 numbers is modulus %

Question 4

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

The operator you wound want to use to find if two values were not the same is the inequality operator !=

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.