Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print 'Hello' to the console.
Javascript
console.[1]('Hello');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'print' which is not a JavaScript console method.
Using 'write' or 'echo' which are not valid console methods.
✗ Incorrect
The console.log method prints messages to the console in JavaScript.
2fill in blank
mediumComplete the code to declare a variable named 'count' with value 5.
Javascript
let [1] = 5;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'var' or 'let' as the variable name instead of the actual name.
Using 'const' which is a keyword, not a variable name.
✗ Incorrect
Variable names go after the keyword. Here, count is the variable name.
3fill in blank
hardFix the error in the function declaration to correctly define a function named greet.
Javascript
function [1]() { console.log('Hi'); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Including parentheses in the function name during declaration.
Using invalid function names.
✗ Incorrect
Function names should not include parentheses in the declaration. Just use the name greet.
4fill in blank
hardFill both blanks to create a for loop that counts from 0 to 4.
Javascript
for (let i = [1]; i [2] 5; i++) { console.log(i); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Starting at 1 instead of 0.
Using <= 5 which would count to 5 instead of 4.
✗ Incorrect
The loop starts at 0 and runs while i is less than 5, counting 0 to 4.
5fill in blank
hardFill all three blanks to create an if statement that checks if x is greater than 10 and prints 'Big'.
Javascript
if ([1] [2] [3]) { console.log('Big'); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the whole condition as one blank instead of separate parts.
Using wrong comparison operators like < or =.
✗ Incorrect
The condition checks if variable x is greater than 10 using the > operator.