Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create an empty object named person.
Javascript
const person = [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
π‘ Hint
Common Mistakes
Using square brackets creates an array, not an object.
Using quotes creates a string, not an object.
β Incorrect
Use curly braces {} to create an empty object in JavaScript.
2fill in blank
mediumComplete the code to create an object car with a property make set to 'Toyota'.
Javascript
const car = [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
π‘ Hint
Common Mistakes
Using square brackets creates an array, not an object.
Leaving out curly braces causes syntax errors.
β Incorrect
Use curly braces with key-value pairs to create an object with properties.
3fill in blank
hardFix the error in the code to create an object book with a property title set to 'JavaScript'.
Javascript
const book = [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
π‘ Hint
Common Mistakes
Using equals sign
= instead of colon : in object literals.Using square brackets or parentheses instead of curly braces.
β Incorrect
Use colon : to assign values to keys in objects, not equals =.
4fill in blank
hardFill both blanks to create an object user with properties name and age.
Javascript
const user = [1] name[2] 'Alice', age: 30 };
Drag options to blanks, or click blank then click option'
Attempts:
3 left
π‘ Hint
Common Mistakes
Using square brackets instead of curly braces to start the object.
Using equals sign
= instead of colon : for properties.β Incorrect
Objects start with { and properties use colon : to assign values.
5fill in blank
hardFill all three blanks to create an object product with properties id, name, and price.
Javascript
const product = [1] id[2] 101, name[3] 'Pen', price: 1.5 };
Drag options to blanks, or click blank then click option'
Attempts:
3 left
π‘ Hint
Common Mistakes
Using equals sign
= instead of colon :.Forgetting commas between properties.
β Incorrect
Start the object with {, use colon : to assign values, and separate properties with commas ,.