Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print the greeting message.
Javascript
console.log('Hello, ' + [1] + '!');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around the variable name, which prints the word instead of its value.
✗ Incorrect
We use the variable name without quotes to concatenate its value.
2fill in blank
mediumComplete the code to join first and last names with a space.
Javascript
let fullName = firstName + [1] + lastName; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using no space or wrong separator characters like underscore or dash.
✗ Incorrect
A space character inside quotes is used to separate the names.
3fill in blank
hardFix the error in concatenating number and string.
Javascript
let message = 'You have ' + [1] + ' new messages.';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string literal '5' instead of the variable holding the count.
✗ Incorrect
Use the variable messageCount which holds the number value to concatenate properly.
4fill in blank
hardFill both blanks to create a sentence with age and city.
Javascript
let info = 'I am ' + [1] + ' years old and live in ' + [2] + '.';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around variable names, which prints the names instead of values.
✗ Incorrect
Use variables age and city without quotes to insert their values.
5fill in blank
hardFill all three blanks to build a full greeting sentence.
Javascript
let greeting = 'Hello, ' + [1] + '! You are ' + [2] + ' years old and from ' + [3] + '.';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around variable names, causing incorrect output.
✗ Incorrect
Use variables userName, userAge, and userCity without quotes to get their values.