Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Creating an Object | Objects Fundamentals
JavaScript Data Structures
course content

Зміст курсу

JavaScript Data Structures

JavaScript Data Structures

1. Introduction and Prerequisites
2. Objects Fundamentals
3. Advanced Object Manipulation
4. Mastering Arrays
5. Advanced Array Operations

bookChallenge: Creating 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
some-alt