Recall & Review
beginner
What does the
== operator do in JavaScript?The
== operator compares two values for equality, allowing type conversion if needed. For example, 5 == '5' is true because the string '5' is converted to number 5 before comparison.Click to reveal answer
beginner
What is the difference between
== and ===?== checks for equality with type conversion, while === checks for equality without type conversion (strict equality). So 5 == '5' is true, but 5 === '5' is false.Click to reveal answer
beginner
What does the
!= operator do?The
!= operator checks if two values are not equal, allowing type conversion. For example, 5 != '6' is true because 5 is not equal to 6 after conversion.Click to reveal answer
beginner
How do the
< and > operators work?The
< operator checks if the value on the left is less than the value on the right. The > operator checks if the left value is greater than the right value. Both compare numbers or strings based on Unicode order.Click to reveal answer
beginner
What is the purpose of
<= and >= operators?The
<= operator checks if the left value is less than or equal to the right value. The >= operator checks if the left value is greater than or equal to the right value.Click to reveal answer
What will
5 == '5' return in JavaScript?✗ Incorrect
== compares values with type conversion, so '5' is converted to number 5, making the comparison true.Which operator checks equality without type conversion?
✗ Incorrect
=== checks strict equality, meaning both value and type must be the same.What does
10 >= 10 evaluate to?✗ Incorrect
>= means greater than or equal, so 10 is equal to 10, making it true.What is the result of
'apple' < 'banana'?✗ Incorrect
Strings are compared by Unicode order. 'apple' comes before 'banana', so it is true.
Which operator means 'not equal' with type conversion?
✗ Incorrect
!= checks if values are not equal, allowing type conversion.Explain the difference between
== and === operators in JavaScript.Think about how JavaScript treats types when comparing.
You got /4 concepts.
List and describe the main comparison operators used to compare numbers or strings in JavaScript.
Focus on operators that compare values and their meanings.
You got /4 concepts.