Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Create and Structure an Object | Fundamentals of JavaScript Objects
JavaScript Data Structures
course content

Зміст курсу

JavaScript Data Structures

JavaScript Data Structures

1. Introduction and Prerequisites
2. Fundamentals of JavaScript Objects
3. Advanced Object Manipulation Techniques
4. Mastering JavaScript Arrays
5. Advanced Array Methods and Transformations

book
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.

123456789
const informationCard = { firstName: ___, lastName: ___, ___: ___, contactDetails: { homeAddress: ___, ___: ___, }, };
copy
  1. Use an object literal to define the outer object.
  2. Inside the outer object, create a property called contactDetails and assign it a nested object.
  3. Inside the nested object, add the necessary properties.
  4. You can fill in any data.
123456789
const informationCard = { firstName: "Alice", lastName: "Smith", age: 25, contactDetails: { homeAddress: "123 Main St, Apt 4B", phoneNumber: "555-123-4567", }, };
copy

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 4
We're sorry to hear that something went wrong. What happened?
some-alt