Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a constant named pi with the value 3.14.
Javascript
const [1] = 3.14;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name that does not describe the value.
Trying to use 'let' or 'var' instead of 'const'.
✗ Incorrect
The keyword
const declares a constant variable. Here, pi is the name of the constant.2fill in blank
mediumComplete the code to declare a constant MAX_USERS with the value 100.
Javascript
const [1] = 100;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using camelCase instead of uppercase with underscores.
Using lowercase letters for constant names.
✗ Incorrect
Constants are often written in uppercase with underscores to separate words. Here,
MAX_USERS is the correct style.3fill in blank
hardFix the error in the code by completing the constant declaration for API_URL.
Javascript
const [1] = 'https://api.example.com';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using camelCase or lowercase for constant names.
Using variable names that do not follow constant naming conventions.
✗ Incorrect
Constants that represent fixed values like URLs are usually written in uppercase with underscores.
API_URL is the correct constant name.4fill in blank
hardFill both blanks to declare constants for SECONDS_IN_MINUTE and MINUTES_IN_HOUR.
Javascript
const [1] = 60; const [2] = 60;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using camelCase instead of uppercase with underscores.
Mixing up the names or values.
✗ Incorrect
Constants are named in uppercase with underscores. Here,
SECONDS_IN_MINUTE and MINUTES_IN_HOUR are the correct names.5fill in blank
hardFill all three blanks to declare constants for PI, EULER, and GRAVITY with their respective values.
Javascript
const [1] = 3.14159; const [2] = 2.71828; const [3] = 9.8;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or camelCase names for constants.
Mixing up the order of constants.
✗ Incorrect
Constants are named in uppercase letters. Here,
PI, EULER, and GRAVITY are the correct constant names.