Operators Worksheet

Question 1

What are the comparison operators used for?

Comparison operators are used to compare two values or expressions. Helping to determine relationships like greater than, less than, equal to, or not equal to.

Question 2

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

The logical and operator (&&) is true only if both conditions are true, while the logical OR operator (||) is true if at least one condition is true.

Question 3

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

To find the remainder when dividing two numbers, you would use the modulus operator (%).

Question 4

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

To find out if two values are NOT equal, you would use the not equal operator, which is represented as [!=].

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.