Operators Worksheet

Question 1

What are the comparison operators used for?

Comparison operators are used to compare two values

Question 2

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

The difference is that double ampersands require both operands to be true or it will return as false, wherass the double lines return true even if one of the operands is false, requiring both operands to be false to return as false.

Question 3

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

I'd use the percentage symbol between the two numbers

Question 4

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

I'd use the != 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.