Operators Worksheet
Question 1
What are the comparison operators used for?
comparison operators are used to compare two values. This can be used in boolean expressions or just to compare two values for other purposes.
Question 2
Explain the difference between the logical AND operator (&&) and the logical OR operator (||).
The main differences between the 'AND' operator vs the 'OR' operator is that the 'AND' requries that that both parts of the statement it is a part of are true for it to be true. While the 'OR' needs only one part of the statement to be true for the whole statement to be true.
Question 3
Which operator would you use to find the remainder from dividing 2 numbers.
The % or modulus operator would be used for this.
Question 4
Which operator would you use if you wanted to find out if two values were NOT equal?
we would use != to see if two values are not equal to each other.
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.