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 (||).
Logical AND operator returns true only if all conditions it connects are true and if any condition is false, then the result will be false, while the Logical OR operator returens true if at least one of the conidition is true and only returns false if all conditions are false.
Question 3
Which operator would you use to find the remainder from dividing 2 numbers.
The modulus operator (%) returns the remainder.
Question 4
Which operator would you use if you wanted to find out if two values were NOT equal?
The inequality (!=) checks whether its two operands 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.