Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print 'Hello, world!' in the browser console.
Javascript
console.[1]('Hello, world!');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using console.print or console.write which do not exist.
Trying to use alert instead of console.
✗ Incorrect
Use console.log to print messages to the browser console.
2fill in blank
mediumComplete the code to declare a variable named 'count' with value 5 and log it.
Javascript
let count = [1];
console.log(count); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the number 5 inside quotes, making it a string.
Using an undefined variable name instead of a number.
✗ Incorrect
Use the number 5 without quotes to assign a numeric value.
3fill in blank
hardFix the error in the code to correctly log the sum of 3 and 4.
Javascript
console.log(3 [1] 4);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using minus or other operators that do not add.
Leaving out the operator entirely.
✗ Incorrect
The plus sign + adds two numbers together.
4fill in blank
hardFill both blanks to create an array of numbers and log its length.
Javascript
const numbers = [[1]]; console.log(numbers[2]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using words like 'size' or 'count' which are not valid properties.
Not separating numbers with commas.
✗ Incorrect
Arrays are created with comma-separated values inside brackets. Use .length to get the number of items.
5fill in blank
hardFill all three blanks to create an object with a name property and log the name.
Javascript
const person = { [1]: [2] };
console.log(person.[3]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different words for the property key and access.
Forgetting quotes around the string value.
✗ Incorrect
Create an object with a property name set to 'Alice'. Access it with person.name.