Title:
JavaScript Operators
Updated:
October 26, 2023
Task/Activity:
- Questions
- Coding Problems
- What are the comparison operators used for?
Figuring out how one value compares to another value, i.e. 1 >= 2 is false.
- Explain the difference between the logical AND operator (&&) and the logical OR operator (||).
The AND operator will only provide a true value if both contained values are equal to true. OR will provide a true value even if only one contained value is equal to true.
- Which operator would you use to find the remainder from dividing 2 numbers.
The modulus(%) operator.
- Which operator would you use if you wanted to find out if two values were NOT equal?
I believe that you would use something along the lines of a!=b.
See the 'script' tag below this section. 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.