The Deep Diver

Medium+30 XP

Mission Briefing

The deep-sea probe has recovered a heavily nested data packet! The coordinates you need are buried deep inside the structure. You must write an extractor script to dive in and get them.

The Concept: Nested Objects

Objects can easily contain other objects as values! To access data deep inside, you just chain your dot notation together. Example: person.contact.email

The Objective

Your function receives a profile object, which contains an address object, which contains a city string.

  1. Navigate through the structure to find the city. (Path: profile.address.city)
  2. Return the value of the city.

01EXAMPLE 1

Inputprofile = { address: { city: "Delhi" } }
Output"Delhi"

Constraints

  • Access the deeply nested property.
CoreObjects
JavaScript
Loading...
3 Hidden

Input Arguments

profile{"address":{"city":"Delhi"}}

Expected Output

Delhi

Click RUN to test your solution