Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print the message to the console.
Javascript
console.log([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the text.
Using print() instead of console.log().
✗ Incorrect
To print text in JavaScript, you must put the text inside quotes as a string.
2fill in blank
mediumComplete the code to print the number 42 to the console.
Javascript
console.log([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting numbers inside quotes makes them strings.
Using number() function which is not needed here.
✗ Incorrect
Numbers are printed without quotes in JavaScript.
3fill in blank
hardFix the error in the code to print the variable value.
Javascript
let name = 'Alice'; console.log([1]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around the variable name.
Writing console.log inside console.log.
✗ Incorrect
To print the value of a variable, use the variable name without quotes.
4fill in blank
hardFill both blanks to print a greeting with a variable.
Javascript
let user = 'Bob'; console.log('Hello, ' + [1] + [2]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around the variable name.
Using wrong punctuation marks.
✗ Incorrect
Use the variable name and add an exclamation mark as a string.
5fill in blank
hardFill all three blanks to print a formatted message using template literals.
Javascript
let age = 30; let name = 'Carol'; console.log(`My name is [1] and I am [2] years [3].`);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting ${} around variables.
Using quotes instead of backticks.
Missing the word 'old' in the sentence.
✗ Incorrect
Use ${variable} inside backticks for variables and add the word 'old' to complete the sentence.