Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to store the number 10 in a variable named score.
Javascript
let score = [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around 10 makes it a string, not a number.
Using the variable name instead of a value.
✗ Incorrect
We use let score = 10; to store the number 10 in the variable score.
2fill in blank
mediumComplete the code to change the value of the variable score to 20.
Javascript
score [1] 20;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using == or === instead of = causes comparison, not assignment.
Writing 'equals' is not valid JavaScript syntax.
✗ Incorrect
Use = to assign a new value to a variable.
3fill in blank
hardFix the error in the code to declare a variable named name with the value 'Alice'.
Javascript
let [1] = 'Alice';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Starting variable names with numbers.
Using spaces inside variable names.
✗ Incorrect
Variable names cannot start with a number or contain spaces. name is a valid variable name.
4fill in blank
hardFill both blanks to create a variable that stores the sum of 5 and 3.
Javascript
let total = [1] [2] 3;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using minus or multiplication instead of addition.
Putting the wrong number or symbol in the blanks.
✗ Incorrect
We add 5 and 3 using the plus sign + and store it in total.
5fill in blank
hardFill all three blanks to create an object with a variable key and value.
Javascript
let [1] = 'color'; let [2] = 'blue'; let obj = { [[1]]: [2] };
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the string 'color' as a variable name directly.
Mixing up variable names and their values.
✗ Incorrect
We create variables key and value to hold strings, then use them to make an object with a key-value pair.