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", }, };
Grazie per i tuoi commenti!
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione
Mi faccia domande su questo argomento
Riassuma questo capitolo
Mostri esempi dal mondo reale
Awesome!
Completion rate improved to 2.27
Challenge: Create and Structure an Object
Scorri per mostrare il menu
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", }, };
Grazie per i tuoi commenti!