0
0
Firebasecloud~10 mins

Comparison operators (==, <, >, >=, <=) in Firebase - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to check if the user's age is exactly 18.

Firebase
if (user.age [1] 18) {
  console.log('User is 18 years old');
}
Drag options to blanks, or click blank then click option'
A>
B<=
C!=
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using = instead of == which assigns rather than compares.
Using != which checks for inequality.
2fill in blank
medium

Complete the code to check if the temperature is greater than 30 degrees.

Firebase
if (temperature [1] 30) {
  console.log('It is hot outside');
}
Drag options to blanks, or click blank then click option'
A>
B<
C==
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using < which checks for less than.
Using == which checks for equality.
3fill in blank
hard

Fix the error in the code to check if the score is less than or equal to 100.

Firebase
if (score [1] 100) {
  console.log('Score is within limit');
}
Drag options to blanks, or click blank then click option'
A<
B<=
C=>
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using => which is not a valid comparison operator.
Using only < which excludes equality.
4fill in blank
hard

Fill both blanks to check if the user's score is between 50 and 100 inclusive.

Firebase
if (score [1] 50 && score [2] 100) {
  console.log('Score is in range');
}
Drag options to blanks, or click blank then click option'
A>=
B<
C<=
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using > instead of >= excludes 50.
Using < instead of <= excludes 100.
5fill in blank
hard

Fill all three blanks to filter users with age greater than 18, score less than 100, and status equal to 'active'.

Firebase
if (user.age [1] 18 && user.score [2] 100 && user.status [3] 'active') {
  console.log('User is eligible');
}
Drag options to blanks, or click blank then click option'
A>
B<
C==
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using != instead of == for status check.
Mixing up < and > for age and score.