Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a variable named age using var.
Javascript
var [1] = 25;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using keywords like let or const instead of the variable name.
Using a number or type instead of a variable name.
✗ Incorrect
Use var followed by the variable name age to declare it.
2fill in blank
mediumComplete the code to declare a variable named name and assign it the value 'Alice' using var.
Javascript
var [1] = 'Alice';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using let or const instead of the variable name.
Using a type name like string instead of the variable name.
✗ Incorrect
The variable name should be name to store the string 'Alice'.
3fill in blank
hardFix the error in the code by completing the variable declaration with var.
Javascript
[1] score = 100;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the keyword var.
Using let or const instead of var.
✗ Incorrect
The keyword var is needed to declare the variable score.
4fill in blank
hardFill both blanks to declare two variables x and y using var and assign them values 5 and 10.
Javascript
var [1] = 5, [2] = 10;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using let instead of var.
Using the keyword var twice.
Using wrong variable names.
✗ Incorrect
Use variable names x and y after the var keyword to declare both variables.
5fill in blank
hardFill all three blanks to declare variables a, b, and c using var and assign them values 1, 2, and 3.
Javascript
var [1] = 1, [2] = 2, [3] = 3;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using let instead of var.
Using wrong variable names or order.
Missing commas between variables.
✗ Incorrect
Declare variables a, b, and c separated by commas after the var keyword.