Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to check if both conditions are true.
Javascript
if (a > 5 [1] b < 10) { console.log('Both conditions are true'); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using || instead of && will check if either condition is true.
Using & is a bitwise operator, not logical.
Using ! negates a condition, not combines two.
✗ Incorrect
The logical AND operator (&&) checks if both conditions are true.
2fill in blank
mediumComplete the code to check if at least one condition is true.
Javascript
if (x === 0 [1] y === 0) { console.log('At least one is zero'); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using && requires both conditions to be true, not one.
Using & is a bitwise operator, not logical.
Using ! negates a condition, not combines two.
✗ Incorrect
The logical OR operator (||) checks if at least one condition is true.
3fill in blank
hardFix the error in the condition to correctly negate the expression.
Javascript
if (! (a === 10 [1] b === 20)) { console.log('Condition is false'); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using && inside negation changes the logic incorrectly.
Using & is a bitwise operator, not logical.
Using ! inside the parentheses is redundant.
✗ Incorrect
The negation applies to the OR condition, so || is correct inside the parentheses.
4fill in blank
hardFill both blanks to create a condition that checks if number is between 5 and 15 inclusive.
Javascript
if (number [1] 5 [2] number [3] 15) { console.log('Number is between 5 and 15'); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using || instead of && will allow numbers outside the range.
Using > instead of >= excludes 5.
Using <= instead of < includes 15, which may be incorrect.
✗ Incorrect
The condition uses >= 5 AND < 15 to check the range.
5fill in blank
hardFill all three blanks to create a condition that logs if a string is empty or null.
Javascript
if (str [1] null [2] str [3] '') { console.log('String is empty or null'); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using && will require both conditions to be true, which is impossible.
Using == instead of === can cause unexpected type coercion.
Using & is a bitwise operator, not logical.
✗ Incorrect
The condition checks if str is null OR equals empty string using === and ||.