Challenge: Create and Structure an Object
Task
Create a JavaScript object called informationCard
representing basic personal information. Inside this object, include a nested object with contact details, such as a home address and phone number. The object should have the following structure:
Information card (outer object):
- First Name (e.g.,
"Alice"
); - Last Name (e.g.,
"Smith"
); - Age (e.g.,
25
); - Contact Details (nested object).
Contact Details (nested object):
- Home Address (e.g.,
"123 Main St, Apt 4B"
); - Phone Number (e.g.,
"555-123-4567"
).
Note
In this challenge, nothing will be output in the console after clicking 'Run Code' as we don't
console.log()
anything.
123456789const informationCard = { firstName: ___, lastName: ___, ___: ___, contactDetails: { homeAddress: ___, ___: ___, }, };
- Use an object literal to define the outer object.
- Inside the outer object, create a property called
contactDetails
and assign it a nested object. - Inside the nested object, add the necessary properties.
- You can fill in any data.
123456789const informationCard = { firstName: "Alice", lastName: "Smith", age: 25, contactDetails: { homeAddress: "123 Main St, Apt 4B", phoneNumber: "555-123-4567", }, };
Kiitos palautteestasi!
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Kysy minulta kysymyksiä tästä aiheesta
Tiivistä tämä luku
Näytä käytännön esimerkkejä
Awesome!
Completion rate improved to 2.27
Challenge: Create and Structure an Object
Pyyhkäise näyttääksesi valikon
Task
Create a JavaScript object called informationCard
representing basic personal information. Inside this object, include a nested object with contact details, such as a home address and phone number. The object should have the following structure:
Information card (outer object):
- First Name (e.g.,
"Alice"
); - Last Name (e.g.,
"Smith"
); - Age (e.g.,
25
); - Contact Details (nested object).
Contact Details (nested object):
- Home Address (e.g.,
"123 Main St, Apt 4B"
); - Phone Number (e.g.,
"555-123-4567"
).
Note
In this challenge, nothing will be output in the console after clicking 'Run Code' as we don't
console.log()
anything.
123456789const informationCard = { firstName: ___, lastName: ___, ___: ___, contactDetails: { homeAddress: ___, ___: ___, }, };
- Use an object literal to define the outer object.
- Inside the outer object, create a property called
contactDetails
and assign it a nested object. - Inside the nested object, add the necessary properties.
- You can fill in any data.
123456789const informationCard = { firstName: "Alice", lastName: "Smith", age: 25, contactDetails: { homeAddress: "123 Main St, Apt 4B", phoneNumber: "555-123-4567", }, };
Kiitos palautteestasi!